We learned about relational data and how to combine tables using inner and outer joins:
| function | behavior |
|---|---|
inner_join() |
Keeps observations that appear in x AND y |
left_join() |
Keeps keeps all observations in x |
right_join() |
Keeps all observations in y |
full_join() |
Keeps all observations in x OR y |
We used these functions to merge two rounds of individual-level panel data to data on higher-level units, including clinics and districts:
datR1 %>%
full_join(datR2,
by = "ID",
suffix = c(".r1", ".r2")) %>%
left_join(clinics, by="clinicID") %>%
left_join(districts, by="district")## ID c.age p.knowsHIV.r1 clinicID p.knowsHIV.r2 district public pop
## 1 118 9 1 2 NA A 1 150000
## 2 60 15 1 2 NA A 1 150000
## 3 311 10 1 2 NA A 1 150000
## 4 347 9 0 2 NA A 1 150000
## 5 315 10 0 2 0 A 1 150000
## 6 99 15 1 2 NA A 1 150000
## 7 146 11 0 2 0 A 1 150000
## 8 339 13 1 2 NA A 1 150000
## 9 228 10 1 2 NA A 1 150000
## 10 368 12 1 2 NA A 1 150000
## 11 29 10 1 2 NA A 1 150000
## 12 286 15 1 7 NA A 1 150000
## 13 220 11 0 7 1 A 1 150000
## 14 166 13 0 7 0 A 1 150000
## 15 278 14 0 7 0 A 1 150000
## 16 302 13 1 7 NA A 1 150000
## 17 361 14 1 7 NA A 1 150000
## 18 120 14 1 7 NA A 1 150000
## 19 70 14 0 7 0 A 1 150000
## 20 91 15 1 7 NA A 1 150000
## 21 337 12 1 7 NA A 1 150000
## 22 335 14 1 7 NA A 1 150000
## 23 84 15 1 7 NA A 1 150000
## 24 272 15 1 7 NA A 1 150000
## 25 300 12 0 7 1 A 1 150000
## 26 204 15 0 7 0 A 1 150000
## 27 164 11 1 7 NA A 1 150000
## 28 345 13 0 7 1 A 1 150000
## 29 80 14 0 7 0 A 1 150000
## 30 333 10 0 7 1 A 1 150000
## 31 161 12 0 7 1 A 1 150000
## 32 156 15 1 19 NA A 1 150000
## 33 208 13 1 19 NA A 1 150000
## 34 39 13 0 19 0 A 1 150000
## 35 95 12 1 19 NA A 1 150000
## 36 182 13 1 19 NA A 1 150000
## 37 299 9 0 19 1 A 1 150000
## 38 243 13 1 19 NA A 1 150000
## 39 207 12 1 19 NA A 1 150000
## 40 18 11 1 19 NA A 1 150000
## 41 358 12 1 19 NA A 1 150000
## 42 143 15 1 10 NA A 1 150000
## 43 27 11 0 10 NA A 1 150000
## 44 115 10 1 10 NA A 1 150000
## 45 219 13 0 10 0 A 1 150000
## 46 348 12 0 10 1 A 1 150000
## 47 119 14 1 10 NA A 1 150000
## 48 47 10 1 10 NA A 1 150000
## 49 38 12 1 10 NA A 1 150000
## 50 314 13 0 10 1 A 1 150000
## 51 134 15 1 10 NA A 1 150000
## 52 63 14 1 10 NA A 1 150000
## 53 110 13 1 10 NA A 1 150000
## 54 155 11 0 10 0 A 1 150000
## 55 330 14 1 10 NA A 1 150000
## 56 171 13 0 10 0 A 1 150000
## 57 316 13 1 10 NA A 1 150000
## 58 334 11 1 10 NA A 1 150000
## 59 197 14 0 10 1 A 1 150000
## 60 267 11 1 10 NA A 1 150000
## 61 236 13 1 10 NA A 1 150000
## 62 281 15 1 3 NA A 1 150000
## 63 241 11 1 3 NA A 1 150000
## 64 298 12 1 3 NA A 1 150000
## 65 142 11 1 3 NA A 1 150000
## 66 56 13 1 3 NA A 1 150000
## 67 127 12 1 3 NA A 1 150000
## 68 179 13 1 3 NA A 1 150000
## 69 159 12 1 3 NA A 1 150000
## 70 46 10 0 3 1 A 1 150000
## 71 308 13 1 3 NA A 1 150000
## 72 262 14 1 3 NA A 1 150000
## 73 215 13 1 3 NA A 1 150000
## 74 310 14 1 3 NA A 1 150000
## 75 158 13 0 3 0 A 1 150000
## 76 291 14 1 15 NA A 1 150000
## 77 148 12 0 15 0 A 1 150000
## 78 50 11 0 15 0 A 1 150000
## 79 8 14 1 15 NA A 1 150000
## 80 214 13 0 15 0 A 1 150000
## 81 251 12 1 15 NA A 1 150000
## 82 320 15 1 15 NA A 1 150000
## 83 296 11 0 15 1 A 1 150000
## 84 113 14 1 15 NA A 1 150000
## 85 15 11 0 15 0 A 1 150000
## 86 295 14 1 20 NA A 0 150000
## 87 371 10 0 20 0 A 0 150000
## 88 324 12 0 20 0 A 0 150000
## 89 31 13 0 20 0 A 0 150000
## 90 133 14 1 20 NA A 0 150000
## 91 172 10 0 20 0 A 0 150000
## 92 85 13 1 20 NA A 0 150000
## 93 175 14 1 20 NA A 0 150000
## 94 185 9 0 20 NA A 0 150000
## 95 5 12 1 20 NA A 0 150000
## 96 45 14 1 20 NA A 0 150000
## 97 217 11 0 6 0 A 0 150000
## 98 349 11 1 6 NA A 0 150000
## 99 67 15 1 6 NA A 0 150000
## 100 370 13 0 6 0 A 0 150000
## 101 130 11 1 6 NA A 0 150000
## 102 187 15 0 6 0 A 0 150000
## 103 274 14 1 6 NA A 0 150000
## 104 61 11 0 6 0 A 0 150000
## 105 279 15 1 6 NA A 0 150000
## 106 287 9 1 6 NA A 0 150000
## 107 209 10 1 1 NA A 1 150000
## 108 128 12 0 1 0 A 1 150000
## 109 329 10 0 1 1 A 1 150000
## 110 276 12 0 1 0 A 1 150000
## 111 336 10 1 1 NA A 1 150000
## 112 108 11 0 1 0 A 1 150000
## 113 77 14 0 1 0 A 1 150000
## 114 82 12 1 1 NA A 1 150000
## 115 121 12 0 1 0 A 1 150000
## 116 331 15 1 1 NA A 1 150000
## 117 141 11 1 1 NA A 1 150000
## 118 90 11 0 1 0 A 1 150000
## 119 319 10 1 1 NA A 1 150000
## 120 317 9 0 1 1 A 1 150000
## 121 354 14 1 1 NA A 1 150000
## 122 224 11 0 1 1 A 1 150000
## 123 365 13 1 1 NA A 1 150000
## 124 246 13 0 1 1 A 1 150000
## 125 275 12 0 1 1 A 1 150000
## 126 283 12 1 1 NA A 1 150000
## 127 170 12 1 1 NA A 1 150000
## 128 89 13 1 1 NA A 1 150000
## 129 78 12 0 1 1 A 1 150000
## 130 359 12 0 14 0 A 0 150000
## 131 34 14 1 14 NA A 0 150000
## 132 36 10 1 14 NA A 0 150000
## 133 189 12 1 14 NA A 0 150000
## 134 17 12 1 14 NA A 0 150000
## 135 30 11 1 14 NA A 0 150000
## 136 364 10 0 14 0 A 0 150000
## 137 203 11 1 14 NA A 0 150000
## 138 4 12 1 14 NA A 0 150000
## 139 322 13 1 14 NA A 0 150000
## 140 112 10 1 14 NA A 0 150000
## 141 304 11 1 14 NA A 0 150000
## 142 74 14 1 14 NA A 0 150000
## 143 66 12 0 14 1 A 0 150000
## 144 160 10 1 14 NA A 0 150000
## 145 104 13 1 14 NA A 0 150000
## 146 19 9 0 14 0 A 0 150000
## 147 12 14 1 14 NA A 0 150000
## 148 312 12 1 14 NA A 0 150000
## 149 258 11 1 14 NA A 0 150000
## 150 265 14 1 14 NA A 0 150000
## 151 81 14 1 14 NA A 0 150000
## 152 293 12 1 14 NA A 0 150000
## 153 87 10 1 14 NA A 0 150000
## 154 261 11 1 14 NA A 0 150000
## 155 366 12 0 14 1 A 0 150000
## 156 71 11 0 14 1 A 0 150000
## 157 282 11 0 13 1 B 1 250000
## 158 105 13 0 13 NA B 1 250000
## 159 206 10 1 13 NA B 1 250000
## 160 57 9 1 13 NA B 1 250000
## 161 147 10 1 13 NA B 1 250000
## 162 124 13 1 13 NA B 1 250000
## 163 157 10 1 13 NA B 1 250000
## 164 194 9 0 13 0 B 1 250000
## 165 109 9 1 13 NA B 1 250000
## 166 3 12 1 13 NA B 1 250000
## 167 101 12 1 13 NA B 1 250000
## 168 59 10 1 13 NA B 1 250000
## 169 289 11 0 13 0 B 1 250000
## 170 43 13 1 17 NA B 1 250000
## 171 253 12 0 17 0 B 1 250000
## 172 240 13 1 17 NA B 1 250000
## 173 137 15 0 17 1 B 1 250000
## 174 372 14 1 17 NA B 1 250000
## 175 20 12 0 17 0 B 1 250000
## 176 290 10 1 17 NA B 1 250000
## 177 263 13 1 17 NA B 1 250000
## 178 22 10 1 17 NA B 1 250000
## 179 75 10 0 17 0 B 1 250000
## 180 309 13 1 17 NA B 1 250000
## 181 284 11 0 17 0 B 1 250000
## 182 162 12 1 17 NA B 1 250000
## 183 102 13 1 17 NA B 1 250000
## 184 285 12 1 18 NA B 0 250000
## 185 373 13 1 18 NA B 0 250000
## 186 92 9 0 18 0 B 0 250000
## 187 344 13 1 18 NA B 0 250000
## 188 227 13 1 18 NA B 0 250000
## 189 186 13 0 18 0 B 0 250000
## 190 136 11 1 18 NA B 0 250000
## 191 232 12 1 18 NA B 0 250000
## 192 297 11 0 18 NA B 0 250000
## 193 351 14 1 18 NA B 0 250000
## 194 346 13 0 18 0 B 0 250000
## 195 149 12 1 18 NA B 0 250000
## 196 180 14 0 18 NA B 0 250000
## 197 239 13 1 18 NA B 0 250000
## 198 307 10 1 18 NA B 0 250000
## 199 23 10 1 18 NA B 0 250000
## 200 280 11 1 4 NA B 0 250000
## 201 2 10 1 4 NA B 0 250000
## 202 165 12 1 4 NA B 0 250000
## 203 114 14 1 4 NA B 0 250000
## 204 242 12 1 4 NA B 0 250000
## 205 362 14 0 4 1 B 0 250000
## 206 177 9 0 4 0 B 0 250000
## 207 271 9 1 4 NA B 0 250000
## 208 117 13 1 4 NA B 0 250000
## 209 235 11 1 4 NA B 0 250000
## 210 1 14 0 4 0 B 0 250000
## 211 163 12 1 4 NA B 0 250000
## 212 255 15 1 4 NA B 0 250000
## 213 73 9 0 4 0 B 0 250000
## 214 223 11 1 4 NA B 0 250000
## 215 252 11 1 4 NA B 0 250000
## 216 106 11 0 12 0 B 0 250000
## 217 88 14 1 12 NA B 0 250000
## 218 51 14 1 12 NA B 0 250000
## 219 52 9 1 12 NA B 0 250000
## 220 196 13 1 12 NA B 0 250000
## 221 350 14 1 12 NA B 0 250000
## 222 191 9 1 12 NA B 0 250000
## 223 260 14 0 12 NA B 0 250000
## 224 97 14 1 12 NA B 0 250000
## 225 352 10 1 12 NA B 0 250000
## 226 360 11 1 12 NA B 0 250000
## 227 116 10 1 12 NA B 0 250000
## 228 173 12 1 9 NA B 1 250000
## 229 221 11 1 9 NA B 1 250000
## 230 76 14 0 9 1 B 1 250000
## 231 93 15 1 9 NA B 1 250000
## 232 10 12 1 9 NA B 1 250000
## 233 257 13 1 9 NA B 1 250000
## 234 139 11 1 9 NA B 1 250000
## 235 111 9 0 9 NA B 1 250000
## 236 254 13 0 9 0 B 1 250000
## 237 7 14 1 9 NA B 1 250000
## 238 86 13 1 9 NA B 1 250000
## 239 199 13 1 9 NA B 1 250000
## 240 168 13 1 9 NA B 1 250000
## 241 48 14 1 9 NA B 1 250000
## 242 14 12 1 9 NA B 1 250000
## 243 355 14 1 9 NA B 1 250000
## 244 126 14 1 9 NA B 1 250000
## 245 343 14 1 9 NA B 1 250000
## 246 321 11 1 9 NA B 1 250000
## 247 152 10 1 9 NA B 1 250000
## 248 72 13 0 9 1 B 1 250000
## 249 357 10 1 9 NA B 1 250000
## 250 216 13 1 9 NA B 1 250000
## 251 181 9 0 9 NA B 1 250000
## 252 53 10 0 9 0 B 1 250000
## 253 303 15 1 9 NA B 1 250000
## 254 369 9 0 9 0 B 1 250000
## 255 96 9 1 9 NA B 1 250000
## 256 24 13 1 9 NA B 1 250000
## 257 288 15 1 9 NA B 1 250000
## 258 328 12 1 21 NA B 0 250000
## 259 313 11 1 21 NA B 0 250000
## 260 306 14 1 21 NA B 0 250000
## 261 237 9 0 21 1 B 0 250000
## 262 318 11 1 21 NA B 0 250000
## 263 356 14 1 21 NA B 0 250000
## 264 247 15 0 21 0 B 0 250000
## 265 202 10 0 21 0 B 0 250000
## 266 13 12 0 21 0 B 0 250000
## 267 49 10 1 21 NA B 0 250000
## 268 325 14 1 21 NA B 0 250000
## 269 122 13 1 21 NA B 0 250000
## 270 176 9 0 21 0 B 0 250000
## 271 25 10 1 21 NA B 0 250000
## 272 129 9 1 8 NA B 1 250000
## 273 248 11 1 8 NA B 1 250000
## 274 174 13 0 8 0 B 1 250000
## 275 269 10 0 8 0 B 1 250000
## 276 200 13 1 8 NA B 1 250000
## 277 100 15 1 8 NA B 1 250000
## 278 54 11 1 8 NA B 1 250000
## 279 250 14 1 8 NA B 1 250000
## 280 132 13 1 8 NA B 1 250000
## 281 188 12 0 8 1 B 1 250000
## 282 135 14 1 8 NA B 1 250000
## 283 305 12 1 8 NA B 1 250000
## 284 229 13 1 8 NA B 1 250000
## 285 184 11 1 8 NA B 1 250000
## 286 327 13 0 8 0 B 1 250000
## 287 140 15 0 22 0 B 1 250000
## 288 338 10 0 22 0 B 1 250000
## 289 37 13 1 22 NA B 1 250000
## 290 98 14 0 22 1 B 1 250000
## 291 26 11 1 22 NA B 1 250000
## 292 94 11 1 22 NA B 1 250000
## 293 183 13 1 22 NA B 1 250000
## 294 69 9 1 22 NA B 1 250000
## 295 218 14 1 22 NA B 1 250000
## 296 9 14 1 22 NA B 1 250000
## 297 205 13 0 22 1 B 1 250000
## 298 144 12 1 11 NA B 0 250000
## 299 245 13 0 11 1 B 0 250000
## 300 145 13 1 11 NA B 0 250000
## 301 151 15 1 11 NA B 0 250000
## 302 42 11 1 11 NA B 0 250000
## 303 62 9 1 11 NA B 0 250000
## 304 192 11 1 11 NA B 0 250000
## 305 11 15 0 11 1 B 0 250000
## 306 332 14 1 11 NA B 0 250000
## 307 323 9 1 11 NA B 0 250000
## 308 103 14 1 11 NA B 0 250000
## 309 266 11 1 11 NA B 0 250000
## 310 341 15 1 11 NA B 0 250000
## 311 201 14 1 11 NA B 0 250000
## 312 178 13 1 11 NA B 0 250000
## 313 256 12 1 11 NA B 0 250000
## 314 238 9 1 11 NA B 0 250000
## 315 41 14 1 11 NA B 0 250000
## 316 353 12 1 11 NA B 0 250000
## 317 249 11 0 11 NA B 0 250000
## 318 211 11 0 11 0 B 0 250000
## 319 367 11 0 11 1 B 0 250000
## 320 225 15 1 11 NA B 0 250000
## 321 226 14 0 11 1 B 0 250000
## 322 138 10 1 11 NA B 0 250000
## 323 326 11 1 11 NA B 0 250000
## 324 33 10 1 11 NA B 0 250000
## 325 244 9 0 11 0 B 0 250000
## 326 264 9 0 11 1 B 0 250000
## 327 294 14 1 11 NA B 0 250000
## 328 58 13 1 11 NA B 0 250000
## 329 273 11 0 11 0 B 0 250000
## 330 79 15 1 11 NA B 0 250000
## 331 198 9 0 11 1 B 0 250000
## 332 55 11 0 11 1 B 0 250000
## 333 65 14 0 11 0 B 0 250000
## 334 301 9 0 11 0 B 0 250000
## 335 107 11 1 11 NA B 0 250000
## 336 83 9 1 11 NA B 0 250000
## 337 131 10 1 16 NA B 1 250000
## 338 234 12 1 16 NA B 1 250000
## 339 342 13 0 16 0 B 1 250000
## 340 210 11 1 16 NA B 1 250000
## 341 268 13 1 16 NA B 1 250000
## 342 212 14 1 16 NA B 1 250000
## 343 123 15 1 16 NA B 1 250000
## 344 16 12 0 16 1 B 1 250000
## 345 154 12 1 16 NA B 1 250000
## 346 44 9 0 16 1 B 1 250000
## 347 277 11 1 16 NA B 1 250000
## 348 230 12 0 16 1 B 1 250000
## 349 40 11 1 16 NA B 1 250000
## 350 363 12 0 16 NA B 1 250000
## 351 28 15 0 16 0 B 1 250000
## 352 213 12 0 16 0 B 1 250000
## 353 153 13 1 16 NA B 1 250000
## 354 195 11 0 16 1 B 1 250000
## 355 292 15 0 16 0 B 1 250000
## 356 125 13 1 16 NA B 1 250000
## 357 222 13 1 16 NA B 1 250000
## 358 259 10 0 16 0 B 1 250000
## 359 340 14 1 16 NA B 1 250000
## 360 167 13 1 16 NA B 1 250000
## 361 21 14 1 16 NA B 1 250000
## 362 190 11 1 16 NA B 1 250000
## 363 35 10 0 16 0 B 1 250000
## 364 150 13 1 16 NA B 1 250000
## 365 233 10 0 16 1 B 1 250000
## 366 193 14 0 16 0 B 1 250000
## 367 169 15 1 16 NA B 1 250000
## 368 6 13 1 16 NA B 1 250000
## 369 231 12 1 16 NA B 1 250000
## 370 32 13 1 16 NA B 1 250000
## 371 68 13 0 16 0 B 1 250000
## 372 270 11 1 16 NA B 1 250000
Today we’ll learn about how to work with strings, factors, and dates. Some of today’s examples come from Wickham and Grolemund (2017). By the end of this session, you should be able to:
Ctrl/Cmd+Shift+F10), clear the console (Ctrl/Cmd+L), and clear your workspaceIs your project still open? If not, click on the project icon to load it. (Don’t create a new one.)
Run the following code in your console. Change products to your preferred subfolder.
download.file("https://tinyurl.com/ya26uo6p",
destfile = "products/lab-w07.Rmd")We’ll need:
library(tidyverse)
library(stringr)
library(forcats)
library(lubridate)
library(likert)These are all members of the tidyverse, but not all are loaded automatically when you load tidyverse.
myString1 <- "Hi, this is a string."
myString2 <- 'Single quotes work, too.'
myString3 <- 'You need single quotes when "quoting" within a string.' myString4 <- "I feel like I am forgetting something.Just hit esc when this happens to you. RStudio will help you realize your errors.
Use c() to create a character vector:
aVariable <- c("yes", "no", "no", "yes", "yes")
aVariable## [1] "yes" "no" "no" "yes" "yes"
Count characters in a string:
aVariable## [1] "yes" "no" "no" "yes" "yes"
str_length(aVariable)## [1] 3 2 2 3 3
When applied to a character vector like this, str_length() returns the length of each string in the vector.
Default is to combine with no separation (i.e., sep=""):
str_c(myString1, myString2, myString3)## [1] "Hi, this is a string.Single quotes work, too.You need single quotes when \"quoting\" within a string."
Separate with a space:
str_c(myString1, myString2, myString3,
sep=" ")## [1] "Hi, this is a string. Single quotes work, too. You need single quotes when \"quoting\" within a string."
x <- c("yr2008", "yr2009", "yr2010")
str_sub(x, 3, 6) ## [1] "2008" "2009" "2010"
str_sub(x, -4, -1) # count backwards from right## [1] "2008" "2009" "2010"
case <- c("Here", "ARE", "somE", "words")
str_to_lower(case)## [1] "here" "are" "some" "words"
str_to_upper(case)## [1] "HERE" "ARE" "SOME" "WORDS"
str_to_title(case)## [1] "Here" "Are" "Some" "Words"
white <- c("1", "2", " 3", "4 ")
str_trim(white)## [1] "1" "2" "3" "4"
disclos*, * is a wildcard that lets you search the root disclos and its combinations, like “disclose”, “disclosed”, and “disclosure” x <- c("scale1.item1", "scale1.item2", "scale2.item1")
str_view(x, "item"). matches any character x <- c("scale1.item1", "scale1.item2", "scale2.item1")
str_view(x, "item.") # next character to right. means any character, so to match for a literal “.”, we have to “escape” it with \\.
x <- c("scale1.item1", "scale1.item2", "scale2.item1")
str_view(x, "\\.item") # match ".item" x <- c("hiv", "hiv+", "hiv-", "hiv positive", "virus")
str_view(x, "^h") # from beginning x <- c("hiv", "hiv+", "hiv-", "hiv positive")
str_view(x, "v$") # from end x <- c("hiv", "hiv+", "hiv-", "hiv positive")
str_view(x, "^hiv$") \d x <- c("scale1.item1", "scale1.item2", "scale2.item1", "scales")
str_view(x, "scale\\d")\s x <- c("hiv", "hiv+", "hiv-", "hiv positive")
str_view(x, "hiv\\s") [a] x <- c("scale1.item1a", "scale1.item1b", "scale1.item1c", "scales")
str_view(x, "item\\d[ab]")[^a] x <- c("scale1.item1a", "scale1.item1b", "scale1.item1c", "scales")
str_view(x, "item\\d[^a]") dat <- data.frame(id = seq(from=1, to=10, by=1),
v2 = rnorm(10),
v3 = rnorm(10),
ignore.t0 = rnorm(10),
this.t0 = rnorm(10),
this1.t0 = rnorm(10),
this22.t0 = rnorm(10),
this22a.t0 = rnorm(10),
that.t0 = rnorm(10),
that1.t0 = rnorm(10),
that22.t0 = rnorm(10),
that22a.t0 = rnorm(10),
ignore.t1 = rnorm(10),
this.t1 = rnorm(10),
this1.t1 = rnorm(10),
this22.t1 = rnorm(10),
this22a.t1 = rnorm(10),
that.t1 = rnorm(10),
that1.t1 = rnorm(10),
that22.t1 = rnorm(10),
that22a.t1 = rnorm(10))Variable names:
names(dat)## [1] "id" "v2" "v3" "ignore.t0" "this.t0"
## [6] "this1.t0" "this22.t0" "this22a.t0" "that.t0" "that1.t0"
## [11] "that22.t0" "that22a.t0" "ignore.t1" "this.t1" "this1.t1"
## [16] "this22.t1" "this22a.t1" "that.t1" "that1.t1" "that22.t1"
## [21] "that22a.t1"
I want to subset the data frame to include id and only columns with:
dat2 <-
dat %>%
select(matches("(this|that)\\d+[a-z]?\\.", vars=names(dat)))
glimpse(dat2)## Observations: 10
## Variables: 12
## $ this1.t0 <dbl> -0.9108815, -0.6618353, 0.4968336, 0.4135533, 0.286...
## $ this22.t0 <dbl> 0.2018569, -0.5440602, -0.2336341, 1.2661285, -0.11...
## $ this22a.t0 <dbl> -0.72530596, -0.67056249, 1.47287455, -0.02619400, ...
## $ that1.t0 <dbl> 0.03014354, -0.81099856, 0.46101539, -0.71056238, -...
## $ that22.t0 <dbl> -0.041156157, 0.664881260, 0.004393853, -0.32883473...
## $ that22a.t0 <dbl> 0.15383002, 0.99824294, 0.25070417, 2.23340400, 1.0...
## $ this1.t1 <dbl> 1.0138470, 0.5446233, -0.7655828, 1.2825631, -1.283...
## $ this22.t1 <dbl> 1.1678120, -0.1749043, 0.4090256, 1.2199493, -0.482...
## $ this22a.t1 <dbl> 0.3448926, 0.2591853, -1.3364169, 1.0988876, 1.4540...
## $ that1.t1 <dbl> 0.6688856, -0.6056537, 0.2230527, 0.3335828, 0.4704...
## $ that22.t1 <dbl> -0.70635551, 0.19464744, -1.70643212, -2.76120418, ...
## $ that22a.t1 <dbl> -1.4469816, -0.1362506, -0.5407164, -0.6930922, 0.6...
"(this|that)\\d+[a-z]?\\."
(this|that): “this” OR “that”\\d: followed by 1 or more digits[a-z]?: followed by zero or 1 (?) lowercase letter a-z ([a-z])\\.: followed by a dot## [1] "this1.t0" "this22.t0" "this22a.t0" "that1.t0" "that22.t0"
## [6] "that22a.t0" "this1.t1" "this22.t1" "this22a.t1" "that1.t1"
## [11] "that22.t1" "that22a.t1"
Return a logical vector of matches:
names(dat)## [1] "id" "v2" "v3" "ignore.t0" "this.t0"
## [6] "this1.t0" "this22.t0" "this22a.t0" "that.t0" "that1.t0"
## [11] "that22.t0" "that22a.t0" "ignore.t1" "this.t1" "this1.t1"
## [16] "this22.t1" "this22a.t1" "that.t1" "that1.t1" "that22.t1"
## [21] "that22a.t1"
str_detect(names(dat), "(this|that)\\d+[a-z]?\\.")## [1] FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE FALSE TRUE TRUE
## [12] TRUE FALSE FALSE TRUE TRUE TRUE FALSE TRUE TRUE TRUE
sum(str_detect(names(dat), "(this|that)\\d+[a-z]?\\.")) # how many## [1] 12
Negate with !:
names(dat)## [1] "id" "v2" "v3" "ignore.t0" "this.t0"
## [6] "this1.t0" "this22.t0" "this22a.t0" "that.t0" "that1.t0"
## [11] "that22.t0" "that22a.t0" "ignore.t1" "this.t1" "this1.t1"
## [16] "this22.t1" "this22a.t1" "that.t1" "that1.t1" "that22.t1"
## [21] "that22a.t1"
!str_detect(names(dat), "(this|that)\\d+[a-z]?\\.")## [1] TRUE TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE FALSE FALSE
## [12] FALSE TRUE TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE
sum(!str_detect(names(dat), "(this|that)\\d+[a-z]?\\.")) # how many## [1] 9
x <- c("always", "sometimes", "always", "never", "often")
str_replace_all(x, c("always"="almost always"))## [1] "almost always" "sometimes" "almost always" "never"
## [5] "often"
forcatsFor categorical variables:
x1 <- c("Dec", "Apr", "Jan", "Mar", "Jan", NA)
table(x1)## x1
## Apr Dec Jan Mar
## 1 1 2 1
x2 <- c("Dec", "Apr", "Jam", "Mar", "Jan", NA)
table(x2)## x2
## Apr Dec Jam Jan Mar
## 1 1 1 1 1
sort(x1)## [1] "Apr" "Dec" "Jan" "Jan" "Mar"
month_levels <- c(
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
)
y1 <- factor(x1, levels = month_levels)
table(y1)## y1
## Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
## 2 0 1 1 0 0 0 0 0 0 0 1
sort(y1)## [1] Jan Jan Mar Apr Dec
## Levels: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
table(y1, useNA = "always")## y1
## Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec <NA>
## 2 0 1 1 0 0 0 0 0 0 0 1 1
glimpse(datR1)## Observations: 372
## Variables: 13
## $ p.age.r1 <int> 77, 36, 39, 34, 39, 45, 49, 33, 34, 66, 57...
## $ p.female.r1 <int> 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
## $ doesKnow16d.r1 <int> 1, 1, 1, NA, 1, 1, 1, 1, NA, NA, 1, 1, 1, ...
## $ PHQ91.r1 <int> 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, ...
## $ PHQ92.r1 <int> 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ...
## $ PHQ93.r1 <int> 1, 3, 1, 0, 0, 1, 0, 1, 3, 0, 1, 0, 0, 0, ...
## $ PHQ94.r1 <int> 0, 0, 0, 0, 2, 1, 0, 0, 2, 0, 0, 0, 0, 0, ...
## $ PHQ95.r1 <int> 1, 0, 1, 1, 2, 0, 0, 1, 1, 0, 0, 0, 0, 1, ...
## $ PHQ96.r1 <int> 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, ...
## $ PHQ97.r1 <int> 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, ...
## $ PHQ98.r1 <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
## $ PHQ99.r1 <int> 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
## $ p.disclosureDate.r1 <chr> "2/24/14", "12/30/14", "6/23/14", NA, "12/...
datR1 %>%
select(PHQ91.r1) %>%
mutate(PHQ91.r1 = factor(PHQ91.r1,
levels=c(0, 1, 2, 3),
labels = c("not at all",
"several days",
"more than half the days",
"nearly every day"))) %>%
table()## .
## not at all several days more than half the days
## 265 73 29
## nearly every day
## 5
datR1 %>%
select(contains("PHQ9")) %>%
mutate_at(vars(contains("PHQ9")),
function(x) factor(x,
levels=c(0, 1, 2, 3),
labels = c("not at all",
"several days",
"more than half the days",
"nearly every day")))## PHQ91.r1 PHQ92.r1
## 1 not at all not at all
## 2 several days several days
## 3 not at all several days
## 4 not at all not at all
## 5 not at all several days
## 6 not at all several days
## 7 not at all not at all
## 8 not at all not at all
## 9 more than half the days not at all
## 10 not at all not at all
## 11 not at all not at all
## 12 not at all not at all
## 13 not at all not at all
## 14 not at all not at all
## 15 not at all not at all
## 16 several days more than half the days
## 17 several days several days
## 18 not at all not at all
## 19 not at all not at all
## 20 not at all not at all
## 21 several days not at all
## 22 not at all several days
## 23 not at all not at all
## 24 several days more than half the days
## 25 not at all not at all
## 26 not at all not at all
## 27 not at all not at all
## 28 not at all not at all
## 29 several days several days
## 30 not at all several days
## 31 not at all more than half the days
## 32 several days several days
## 33 not at all not at all
## 34 not at all not at all
## 35 not at all not at all
## 36 several days more than half the days
## 37 several days not at all
## 38 not at all not at all
## 39 not at all nearly every day
## 40 not at all several days
## 41 not at all not at all
## 42 not at all not at all
## 43 not at all not at all
## 44 not at all not at all
## 45 several days several days
## 46 not at all not at all
## 47 several days several days
## 48 not at all several days
## 49 not at all not at all
## 50 not at all not at all
## 51 several days several days
## 52 not at all not at all
## 53 not at all several days
## 54 more than half the days not at all
## 55 not at all not at all
## 56 not at all not at all
## 57 not at all several days
## 58 not at all not at all
## 59 several days not at all
## 60 not at all several days
## 61 not at all not at all
## 62 not at all not at all
## 63 not at all not at all
## 64 not at all not at all
## 65 several days more than half the days
## 66 not at all not at all
## 67 several days several days
## 68 more than half the days not at all
## 69 several days several days
## 70 not at all not at all
## 71 several days several days
## 72 not at all several days
## 73 more than half the days more than half the days
## 74 not at all not at all
## 75 several days several days
## 76 not at all not at all
## 77 not at all not at all
## 78 not at all more than half the days
## 79 not at all several days
## 80 more than half the days not at all
## 81 not at all several days
## 82 not at all several days
## 83 more than half the days more than half the days
## 84 not at all not at all
## 85 not at all not at all
## 86 not at all not at all
## 87 not at all not at all
## 88 not at all not at all
## 89 not at all more than half the days
## 90 not at all not at all
## 91 several days several days
## 92 several days several days
## 93 not at all not at all
## 94 not at all not at all
## 95 not at all not at all
## 96 not at all several days
## 97 several days not at all
## 98 not at all several days
## 99 not at all more than half the days
## 100 not at all not at all
## 101 not at all several days
## 102 not at all several days
## 103 not at all not at all
## 104 not at all not at all
## 105 not at all not at all
## 106 not at all not at all
## 107 not at all more than half the days
## 108 more than half the days several days
## 109 not at all not at all
## 110 not at all not at all
## 111 not at all more than half the days
## 112 more than half the days not at all
## 113 not at all several days
## 114 not at all several days
## 115 not at all several days
## 116 more than half the days several days
## 117 not at all not at all
## 118 several days several days
## 119 not at all not at all
## 120 not at all several days
## 121 not at all not at all
## 122 not at all not at all
## 123 not at all several days
## 124 not at all not at all
## 125 not at all not at all
## 126 several days several days
## 127 not at all not at all
## 128 several days several days
## 129 nearly every day nearly every day
## 130 not at all not at all
## 131 not at all not at all
## 132 not at all not at all
## 133 not at all not at all
## 134 not at all not at all
## 135 several days not at all
## 136 not at all several days
## 137 not at all not at all
## 138 not at all several days
## 139 not at all several days
## 140 not at all not at all
## 141 more than half the days more than half the days
## 142 not at all not at all
## 143 not at all not at all
## 144 not at all not at all
## 145 several days several days
## 146 several days not at all
## 147 not at all not at all
## 148 not at all not at all
## 149 not at all not at all
## 150 not at all not at all
## 151 not at all not at all
## 152 not at all several days
## 153 not at all several days
## 154 not at all not at all
## 155 not at all not at all
## 156 not at all not at all
## 157 not at all not at all
## 158 several days several days
## 159 not at all several days
## 160 not at all not at all
## 161 not at all not at all
## 162 nearly every day several days
## 163 more than half the days several days
## 164 not at all not at all
## 165 not at all not at all
## 166 not at all not at all
## 167 not at all not at all
## 168 more than half the days not at all
## 169 not at all several days
## 170 more than half the days nearly every day
## 171 not at all not at all
## 172 several days more than half the days
## 173 several days several days
## 174 several days not at all
## 175 not at all not at all
## 176 several days not at all
## 177 not at all not at all
## 178 not at all not at all
## 179 not at all not at all
## 180 several days several days
## 181 not at all not at all
## 182 not at all not at all
## 183 more than half the days more than half the days
## 184 not at all not at all
## 185 not at all several days
## 186 several days several days
## 187 not at all not at all
## 188 not at all not at all
## 189 not at all more than half the days
## 190 several days not at all
## 191 not at all several days
## 192 not at all several days
## 193 not at all nearly every day
## 194 not at all not at all
## 195 several days more than half the days
## 196 not at all not at all
## 197 more than half the days not at all
## 198 not at all not at all
## 199 several days several days
## 200 several days several days
## 201 not at all not at all
## 202 more than half the days not at all
## 203 not at all not at all
## 204 several days several days
## 205 nearly every day nearly every day
## 206 not at all several days
## 207 not at all several days
## 208 not at all not at all
## 209 not at all not at all
## 210 not at all not at all
## 211 more than half the days more than half the days
## 212 several days more than half the days
## 213 several days several days
## 214 not at all not at all
## 215 several days more than half the days
## 216 not at all not at all
## 217 not at all several days
## 218 not at all several days
## 219 not at all not at all
## 220 not at all more than half the days
## 221 several days not at all
## 222 not at all not at all
## 223 not at all not at all
## 224 not at all not at all
## 225 not at all several days
## 226 not at all not at all
## 227 not at all not at all
## 228 not at all not at all
## 229 several days more than half the days
## 230 several days several days
## 231 not at all not at all
## 232 not at all several days
## 233 more than half the days not at all
## 234 not at all several days
## 235 not at all not at all
## 236 not at all not at all
## 237 not at all not at all
## 238 several days several days
## 239 not at all not at all
## 240 not at all several days
## 241 several days several days
## 242 not at all more than half the days
## 243 several days not at all
## 244 not at all not at all
## 245 not at all not at all
## 246 several days not at all
## 247 not at all not at all
## 248 more than half the days more than half the days
## 249 not at all several days
## 250 several days not at all
## 251 several days several days
## 252 not at all not at all
## 253 not at all not at all
## 254 not at all not at all
## 255 not at all not at all
## 256 not at all not at all
## 257 several days several days
## 258 several days several days
## 259 not at all not at all
## 260 not at all nearly every day
## 261 not at all not at all
## 262 not at all not at all
## 263 not at all not at all
## 264 not at all several days
## 265 not at all several days
## 266 not at all not at all
## 267 several days more than half the days
## 268 several days not at all
## 269 not at all not at all
## 270 not at all not at all
## 271 not at all not at all
## 272 several days several days
## 273 not at all not at all
## 274 not at all not at all
## 275 not at all not at all
## 276 not at all several days
## 277 several days several days
## 278 more than half the days not at all
## 279 not at all several days
## 280 not at all not at all
## 281 not at all not at all
## 282 not at all not at all
## 283 not at all not at all
## 284 not at all not at all
## 285 not at all not at all
## 286 several days several days
## 287 not at all not at all
## 288 not at all several days
## 289 not at all not at all
## 290 not at all not at all
## 291 not at all not at all
## 292 not at all not at all
## 293 not at all more than half the days
## 294 several days not at all
## 295 not at all several days
## 296 not at all not at all
## 297 several days several days
## 298 not at all not at all
## 299 not at all several days
## 300 not at all not at all
## 301 not at all several days
## 302 not at all not at all
## 303 more than half the days not at all
## 304 several days more than half the days
## 305 not at all not at all
## 306 not at all several days
## 307 not at all not at all
## 308 not at all not at all
## 309 several days several days
## 310 more than half the days not at all
## 311 more than half the days more than half the days
## 312 not at all not at all
## 313 not at all more than half the days
## 314 not at all several days
## 315 not at all not at all
## 316 not at all not at all
## 317 not at all not at all
## 318 not at all not at all
## 319 several days more than half the days
## 320 not at all several days
## 321 not at all several days
## 322 more than half the days nearly every day
## 323 not at all several days
## 324 not at all not at all
## 325 not at all not at all
## 326 not at all more than half the days
## 327 more than half the days several days
## 328 several days not at all
## 329 several days several days
## 330 more than half the days more than half the days
## 331 not at all not at all
## 332 not at all not at all
## 333 not at all not at all
## 334 several days not at all
## 335 several days several days
## 336 not at all more than half the days
## 337 not at all not at all
## 338 not at all several days
## 339 several days more than half the days
## 340 not at all not at all
## 341 more than half the days more than half the days
## 342 not at all not at all
## 343 not at all not at all
## 344 not at all not at all
## 345 not at all not at all
## 346 nearly every day nearly every day
## 347 not at all not at all
## 348 several days not at all
## 349 several days several days
## 350 not at all not at all
## 351 nearly every day nearly every day
## 352 not at all not at all
## 353 not at all not at all
## 354 not at all not at all
## 355 not at all not at all
## 356 several days several days
## 357 several days not at all
## 358 more than half the days more than half the days
## 359 several days not at all
## 360 not at all not at all
## 361 not at all more than half the days
## 362 not at all nearly every day
## 363 not at all not at all
## 364 more than half the days more than half the days
## 365 not at all more than half the days
## 366 not at all not at all
## 367 not at all not at all
## 368 not at all not at all
## 369 not at all not at all
## 370 not at all more than half the days
## 371 not at all not at all
## 372 not at all not at all
## PHQ93.r1 PHQ94.r1
## 1 several days not at all
## 2 nearly every day not at all
## 3 several days not at all
## 4 not at all not at all
## 5 not at all more than half the days
## 6 several days several days
## 7 not at all not at all
## 8 several days not at all
## 9 nearly every day more than half the days
## 10 not at all not at all
## 11 several days not at all
## 12 not at all not at all
## 13 not at all not at all
## 14 not at all not at all
## 15 not at all not at all
## 16 several days several days
## 17 several days several days
## 18 not at all not at all
## 19 not at all several days
## 20 not at all not at all
## 21 not at all several days
## 22 several days not at all
## 23 several days not at all
## 24 more than half the days not at all
## 25 not at all not at all
## 26 not at all not at all
## 27 not at all not at all
## 28 not at all not at all
## 29 several days not at all
## 30 not at all not at all
## 31 more than half the days more than half the days
## 32 several days several days
## 33 not at all not at all
## 34 not at all not at all
## 35 several days not at all
## 36 not at all several days
## 37 more than half the days more than half the days
## 38 not at all not at all
## 39 more than half the days not at all
## 40 not at all not at all
## 41 not at all not at all
## 42 several days not at all
## 43 not at all not at all
## 44 nearly every day not at all
## 45 not at all not at all
## 46 not at all not at all
## 47 more than half the days several days
## 48 nearly every day several days
## 49 not at all several days
## 50 not at all not at all
## 51 more than half the days more than half the days
## 52 not at all not at all
## 53 not at all not at all
## 54 not at all not at all
## 55 not at all not at all
## 56 several days not at all
## 57 several days several days
## 58 several days not at all
## 59 not at all not at all
## 60 several days several days
## 61 not at all not at all
## 62 not at all not at all
## 63 several days not at all
## 64 not at all not at all
## 65 nearly every day more than half the days
## 66 not at all not at all
## 67 several days several days
## 68 several days several days
## 69 several days several days
## 70 not at all not at all
## 71 not at all several days
## 72 more than half the days more than half the days
## 73 more than half the days more than half the days
## 74 several days not at all
## 75 several days not at all
## 76 several days not at all
## 77 several days not at all
## 78 several days not at all
## 79 several days not at all
## 80 more than half the days more than half the days
## 81 more than half the days not at all
## 82 not at all not at all
## 83 more than half the days more than half the days
## 84 several days several days
## 85 not at all several days
## 86 not at all not at all
## 87 not at all several days
## 88 not at all not at all
## 89 more than half the days not at all
## 90 not at all not at all
## 91 several days not at all
## 92 several days several days
## 93 several days not at all
## 94 not at all not at all
## 95 not at all not at all
## 96 several days not at all
## 97 several days not at all
## 98 several days not at all
## 99 more than half the days not at all
## 100 not at all not at all
## 101 not at all not at all
## 102 several days several days
## 103 not at all not at all
## 104 not at all several days
## 105 not at all not at all
## 106 not at all not at all
## 107 more than half the days more than half the days
## 108 not at all not at all
## 109 not at all not at all
## 110 several days not at all
## 111 more than half the days several days
## 112 not at all not at all
## 113 several days not at all
## 114 several days several days
## 115 several days not at all
## 116 several days several days
## 117 several days not at all
## 118 several days several days
## 119 several days not at all
## 120 several days not at all
## 121 more than half the days more than half the days
## 122 several days not at all
## 123 several days not at all
## 124 not at all not at all
## 125 several days not at all
## 126 not at all several days
## 127 not at all not at all
## 128 more than half the days more than half the days
## 129 nearly every day nearly every day
## 130 not at all not at all
## 131 not at all not at all
## 132 not at all more than half the days
## 133 several days several days
## 134 several days not at all
## 135 not at all not at all
## 136 more than half the days more than half the days
## 137 not at all not at all
## 138 several days several days
## 139 not at all not at all
## 140 not at all not at all
## 141 more than half the days not at all
## 142 not at all not at all
## 143 not at all not at all
## 144 not at all not at all
## 145 more than half the days several days
## 146 more than half the days not at all
## 147 not at all not at all
## 148 not at all not at all
## 149 not at all not at all
## 150 not at all not at all
## 151 not at all not at all
## 152 several days not at all
## 153 several days several days
## 154 several days several days
## 155 more than half the days not at all
## 156 not at all not at all
## 157 not at all not at all
## 158 several days several days
## 159 not at all several days
## 160 not at all not at all
## 161 not at all not at all
## 162 several days several days
## 163 several days not at all
## 164 several days not at all
## 165 not at all not at all
## 166 several days not at all
## 167 not at all not at all
## 168 more than half the days not at all
## 169 several days more than half the days
## 170 nearly every day nearly every day
## 171 not at all not at all
## 172 several days more than half the days
## 173 not at all several days
## 174 more than half the days more than half the days
## 175 not at all not at all
## 176 several days several days
## 177 several days not at all
## 178 several days not at all
## 179 not at all not at all
## 180 several days not at all
## 181 not at all not at all
## 182 not at all not at all
## 183 more than half the days more than half the days
## 184 not at all not at all
## 185 not at all not at all
## 186 not at all not at all
## 187 not at all not at all
## 188 several days several days
## 189 more than half the days not at all
## 190 not at all several days
## 191 several days several days
## 192 several days not at all
## 193 more than half the days not at all
## 194 not at all not at all
## 195 several days several days
## 196 not at all not at all
## 197 several days not at all
## 198 several days several days
## 199 more than half the days more than half the days
## 200 more than half the days more than half the days
## 201 not at all not at all
## 202 not at all not at all
## 203 several days not at all
## 204 several days several days
## 205 nearly every day nearly every day
## 206 several days not at all
## 207 more than half the days more than half the days
## 208 not at all not at all
## 209 several days not at all
## 210 not at all not at all
## 211 more than half the days more than half the days
## 212 more than half the days more than half the days
## 213 more than half the days not at all
## 214 not at all several days
## 215 more than half the days several days
## 216 not at all not at all
## 217 several days not at all
## 218 not at all not at all
## 219 several days not at all
## 220 more than half the days not at all
## 221 nearly every day not at all
## 222 not at all not at all
## 223 not at all not at all
## 224 more than half the days not at all
## 225 not at all not at all
## 226 not at all not at all
## 227 not at all not at all
## 228 more than half the days more than half the days
## 229 several days several days
## 230 several days several days
## 231 several days not at all
## 232 several days not at all
## 233 not at all not at all
## 234 not at all not at all
## 235 not at all not at all
## 236 not at all not at all
## 237 several days not at all
## 238 several days several days
## 239 not at all not at all
## 240 several days not at all
## 241 several days several days
## 242 more than half the days not at all
## 243 several days several days
## 244 not at all several days
## 245 not at all not at all
## 246 not at all not at all
## 247 not at all not at all
## 248 more than half the days nearly every day
## 249 not at all not at all
## 250 several days several days
## 251 several days several days
## 252 several days not at all
## 253 several days not at all
## 254 not at all not at all
## 255 not at all not at all
## 256 not at all not at all
## 257 several days several days
## 258 several days not at all
## 259 not at all not at all
## 260 several days several days
## 261 not at all not at all
## 262 not at all not at all
## 263 not at all not at all
## 264 several days not at all
## 265 not at all not at all
## 266 not at all not at all
## 267 nearly every day not at all
## 268 not at all not at all
## 269 not at all not at all
## 270 several days not at all
## 271 several days several days
## 272 several days more than half the days
## 273 nearly every day not at all
## 274 not at all not at all
## 275 several days not at all
## 276 several days not at all
## 277 several days several days
## 278 several days not at all
## 279 several days not at all
## 280 not at all not at all
## 281 not at all not at all
## 282 not at all several days
## 283 more than half the days not at all
## 284 not at all not at all
## 285 not at all not at all
## 286 several days several days
## 287 more than half the days several days
## 288 several days not at all
## 289 more than half the days not at all
## 290 not at all not at all
## 291 several days not at all
## 292 several days not at all
## 293 not at all not at all
## 294 several days not at all
## 295 several days several days
## 296 several days not at all
## 297 several days not at all
## 298 several days not at all
## 299 more than half the days not at all
## 300 not at all not at all
## 301 several days several days
## 302 several days not at all
## 303 more than half the days not at all
## 304 more than half the days more than half the days
## 305 several days not at all
## 306 several days several days
## 307 not at all not at all
## 308 not at all not at all
## 309 more than half the days several days
## 310 several days several days
## 311 nearly every day not at all
## 312 not at all not at all
## 313 several days not at all
## 314 several days several days
## 315 not at all not at all
## 316 several days several days
## 317 several days several days
## 318 several days not at all
## 319 more than half the days more than half the days
## 320 not at all not at all
## 321 more than half the days not at all
## 322 nearly every day nearly every day
## 323 several days not at all
## 324 not at all not at all
## 325 not at all not at all
## 326 more than half the days several days
## 327 several days several days
## 328 not at all not at all
## 329 several days several days
## 330 more than half the days more than half the days
## 331 not at all several days
## 332 not at all not at all
## 333 several days not at all
## 334 more than half the days not at all
## 335 not at all several days
## 336 more than half the days not at all
## 337 not at all not at all
## 338 several days not at all
## 339 not at all not at all
## 340 several days several days
## 341 more than half the days nearly every day
## 342 several days not at all
## 343 several days not at all
## 344 several days not at all
## 345 several days not at all
## 346 nearly every day nearly every day
## 347 not at all not at all
## 348 more than half the days not at all
## 349 not at all not at all
## 350 several days not at all
## 351 nearly every day nearly every day
## 352 not at all not at all
## 353 not at all not at all
## 354 not at all not at all
## 355 not at all not at all
## 356 several days not at all
## 357 several days not at all
## 358 more than half the days more than half the days
## 359 several days several days
## 360 several days not at all
## 361 several days not at all
## 362 not at all not at all
## 363 several days not at all
## 364 more than half the days not at all
## 365 several days not at all
## 366 not at all not at all
## 367 not at all not at all
## 368 not at all not at all
## 369 not at all several days
## 370 more than half the days several days
## 371 more than half the days more than half the days
## 372 several days not at all
## PHQ95.r1 PHQ96.r1
## 1 several days not at all
## 2 not at all several days
## 3 several days not at all
## 4 several days not at all
## 5 more than half the days several days
## 6 not at all not at all
## 7 not at all not at all
## 8 several days not at all
## 9 several days not at all
## 10 not at all not at all
## 11 not at all not at all
## 12 not at all not at all
## 13 not at all not at all
## 14 several days several days
## 15 not at all not at all
## 16 several days not at all
## 17 several days several days
## 18 several days not at all
## 19 several days not at all
## 20 not at all not at all
## 21 several days not at all
## 22 several days not at all
## 23 several days not at all
## 24 not at all not at all
## 25 several days not at all
## 26 not at all not at all
## 27 not at all not at all
## 28 not at all not at all
## 29 several days more than half the days
## 30 more than half the days not at all
## 31 more than half the days more than half the days
## 32 not at all several days
## 33 not at all not at all
## 34 not at all not at all
## 35 not at all not at all
## 36 several days several days
## 37 not at all not at all
## 38 not at all not at all
## 39 not at all not at all
## 40 several days several days
## 41 not at all not at all
## 42 not at all not at all
## 43 not at all not at all
## 44 not at all not at all
## 45 several days more than half the days
## 46 not at all not at all
## 47 several days several days
## 48 several days several days
## 49 more than half the days not at all
## 50 several days not at all
## 51 not at all not at all
## 52 not at all not at all
## 53 not at all not at all
## 54 more than half the days not at all
## 55 not at all not at all
## 56 not at all not at all
## 57 not at all not at all
## 58 not at all not at all
## 59 not at all not at all
## 60 several days several days
## 61 not at all not at all
## 62 not at all several days
## 63 not at all not at all
## 64 not at all not at all
## 65 more than half the days several days
## 66 not at all not at all
## 67 not at all several days
## 68 several days not at all
## 69 nearly every day several days
## 70 not at all not at all
## 71 several days several days
## 72 more than half the days several days
## 73 more than half the days not at all
## 74 not at all not at all
## 75 not at all several days
## 76 several days not at all
## 77 not at all not at all
## 78 not at all several days
## 79 not at all not at all
## 80 more than half the days not at all
## 81 not at all several days
## 82 several days several days
## 83 several days several days
## 84 not at all not at all
## 85 not at all not at all
## 86 not at all not at all
## 87 several days not at all
## 88 not at all not at all
## 89 several days not at all
## 90 not at all not at all
## 91 several days not at all
## 92 several days not at all
## 93 not at all several days
## 94 not at all not at all
## 95 not at all not at all
## 96 not at all not at all
## 97 several days not at all
## 98 several days not at all
## 99 several days several days
## 100 not at all not at all
## 101 not at all not at all
## 102 several days several days
## 103 not at all not at all
## 104 not at all not at all
## 105 not at all not at all
## 106 not at all not at all
## 107 more than half the days more than half the days
## 108 not at all not at all
## 109 not at all not at all
## 110 not at all not at all
## 111 several days several days
## 112 not at all not at all
## 113 several days not at all
## 114 several days not at all
## 115 not at all not at all
## 116 several days not at all
## 117 several days not at all
## 118 more than half the days several days
## 119 several days not at all
## 120 several days not at all
## 121 not at all not at all
## 122 not at all not at all
## 123 several days not at all
## 124 not at all not at all
## 125 not at all not at all
## 126 several days not at all
## 127 not at all not at all
## 128 nearly every day more than half the days
## 129 more than half the days more than half the days
## 130 not at all not at all
## 131 not at all not at all
## 132 not at all more than half the days
## 133 not at all not at all
## 134 not at all several days
## 135 not at all not at all
## 136 more than half the days more than half the days
## 137 not at all not at all
## 138 several days several days
## 139 several days several days
## 140 more than half the days several days
## 141 nearly every day nearly every day
## 142 several days not at all
## 143 not at all not at all
## 144 several days not at all
## 145 several days not at all
## 146 not at all not at all
## 147 not at all not at all
## 148 not at all not at all
## 149 not at all not at all
## 150 not at all more than half the days
## 151 several days not at all
## 152 not at all several days
## 153 several days several days
## 154 not at all not at all
## 155 several days not at all
## 156 more than half the days not at all
## 157 several days several days
## 158 not at all not at all
## 159 not at all more than half the days
## 160 not at all not at all
## 161 nearly every day not at all
## 162 several days not at all
## 163 more than half the days not at all
## 164 not at all not at all
## 165 not at all several days
## 166 more than half the days not at all
## 167 not at all not at all
## 168 several days not at all
## 169 several days several days
## 170 more than half the days several days
## 171 not at all not at all
## 172 not at all not at all
## 173 several days not at all
## 174 not at all not at all
## 175 not at all not at all
## 176 several days not at all
## 177 several days not at all
## 178 not at all not at all
## 179 not at all not at all
## 180 not at all not at all
## 181 not at all not at all
## 182 not at all not at all
## 183 more than half the days several days
## 184 not at all not at all
## 185 not at all not at all
## 186 not at all not at all
## 187 not at all not at all
## 188 several days not at all
## 189 more than half the days more than half the days
## 190 more than half the days not at all
## 191 not at all several days
## 192 not at all not at all
## 193 not at all more than half the days
## 194 not at all not at all
## 195 more than half the days not at all
## 196 not at all not at all
## 197 several days several days
## 198 several days not at all
## 199 several days not at all
## 200 more than half the days not at all
## 201 more than half the days not at all
## 202 more than half the days not at all
## 203 not at all not at all
## 204 several days several days
## 205 more than half the days more than half the days
## 206 not at all not at all
## 207 more than half the days nearly every day
## 208 not at all not at all
## 209 not at all not at all
## 210 not at all not at all
## 211 more than half the days more than half the days
## 212 more than half the days not at all
## 213 nearly every day several days
## 214 not at all not at all
## 215 several days more than half the days
## 216 not at all not at all
## 217 not at all not at all
## 218 not at all several days
## 219 several days not at all
## 220 not at all more than half the days
## 221 not at all several days
## 222 not at all not at all
## 223 not at all not at all
## 224 not at all not at all
## 225 not at all not at all
## 226 not at all not at all
## 227 several days not at all
## 228 more than half the days not at all
## 229 several days not at all
## 230 not at all not at all
## 231 not at all not at all
## 232 several days not at all
## 233 nearly every day not at all
## 234 not at all more than half the days
## 235 not at all not at all
## 236 not at all not at all
## 237 several days not at all
## 238 several days not at all
## 239 not at all not at all
## 240 not at all not at all
## 241 several days not at all
## 242 not at all not at all
## 243 not at all several days
## 244 not at all not at all
## 245 not at all not at all
## 246 not at all not at all
## 247 not at all more than half the days
## 248 several days not at all
## 249 several days not at all
## 250 several days not at all
## 251 not at all not at all
## 252 not at all not at all
## 253 not at all not at all
## 254 not at all not at all
## 255 not at all not at all
## 256 not at all not at all
## 257 several days several days
## 258 several days not at all
## 259 not at all not at all
## 260 several days several days
## 261 not at all not at all
## 262 more than half the days several days
## 263 not at all not at all
## 264 not at all not at all
## 265 not at all not at all
## 266 several days nearly every day
## 267 several days more than half the days
## 268 several days not at all
## 269 not at all not at all
## 270 not at all not at all
## 271 several days not at all
## 272 several days not at all
## 273 not at all not at all
## 274 not at all not at all
## 275 not at all not at all
## 276 not at all several days
## 277 several days several days
## 278 not at all not at all
## 279 several days not at all
## 280 not at all not at all
## 281 not at all not at all
## 282 several days not at all
## 283 more than half the days not at all
## 284 not at all not at all
## 285 not at all not at all
## 286 several days several days
## 287 several days more than half the days
## 288 not at all not at all
## 289 not at all not at all
## 290 not at all not at all
## 291 more than half the days not at all
## 292 not at all several days
## 293 not at all several days
## 294 more than half the days not at all
## 295 not at all not at all
## 296 more than half the days not at all
## 297 more than half the days not at all
## 298 several days not at all
## 299 more than half the days not at all
## 300 not at all not at all
## 301 more than half the days more than half the days
## 302 not at all not at all
## 303 not at all more than half the days
## 304 more than half the days more than half the days
## 305 not at all not at all
## 306 more than half the days not at all
## 307 not at all not at all
## 308 not at all not at all
## 309 not at all several days
## 310 several days not at all
## 311 several days not at all
## 312 not at all not at all
## 313 several days not at all
## 314 nearly every day more than half the days
## 315 not at all not at all
## 316 not at all more than half the days
## 317 not at all not at all
## 318 not at all not at all
## 319 more than half the days more than half the days
## 320 not at all not at all
## 321 not at all not at all
## 322 not at all not at all
## 323 not at all not at all
## 324 not at all not at all
## 325 not at all not at all
## 326 more than half the days not at all
## 327 not at all more than half the days
## 328 not at all not at all
## 329 more than half the days not at all
## 330 more than half the days more than half the days
## 331 several days not at all
## 332 not at all not at all
## 333 not at all not at all
## 334 not at all several days
## 335 several days not at all
## 336 not at all not at all
## 337 not at all not at all
## 338 not at all not at all
## 339 several days several days
## 340 not at all not at all
## 341 nearly every day not at all
## 342 not at all not at all
## 343 not at all not at all
## 344 not at all not at all
## 345 several days not at all
## 346 nearly every day not at all
## 347 several days not at all
## 348 more than half the days several days
## 349 not at all not at all
## 350 not at all not at all
## 351 nearly every day not at all
## 352 not at all not at all
## 353 not at all not at all
## 354 not at all not at all
## 355 not at all several days
## 356 several days not at all
## 357 not at all several days
## 358 more than half the days not at all
## 359 several days not at all
## 360 not at all not at all
## 361 not at all not at all
## 362 nearly every day not at all
## 363 not at all not at all
## 364 more than half the days not at all
## 365 not at all not at all
## 366 not at all not at all
## 367 not at all not at all
## 368 not at all not at all
## 369 not at all several days
## 370 not at all not at all
## 371 more than half the days not at all
## 372 not at all not at all
## PHQ97.r1 PHQ98.r1
## 1 not at all not at all
## 2 several days not at all
## 3 not at all not at all
## 4 not at all not at all
## 5 not at all not at all
## 6 several days not at all
## 7 not at all not at all
## 8 not at all not at all
## 9 not at all not at all
## 10 not at all not at all
## 11 not at all not at all
## 12 not at all not at all
## 13 not at all not at all
## 14 not at all not at all
## 15 not at all not at all
## 16 not at all not at all
## 17 several days not at all
## 18 several days not at all
## 19 not at all not at all
## 20 several days several days
## 21 not at all not at all
## 22 not at all not at all
## 23 not at all not at all
## 24 not at all not at all
## 25 not at all not at all
## 26 not at all not at all
## 27 not at all not at all
## 28 not at all not at all
## 29 not at all several days
## 30 not at all several days
## 31 several days not at all
## 32 several days not at all
## 33 not at all not at all
## 34 not at all not at all
## 35 not at all not at all
## 36 several days several days
## 37 not at all not at all
## 38 not at all not at all
## 39 not at all not at all
## 40 several days not at all
## 41 not at all not at all
## 42 not at all not at all
## 43 not at all not at all
## 44 not at all not at all
## 45 not at all several days
## 46 not at all not at all
## 47 not at all not at all
## 48 several days several days
## 49 not at all not at all
## 50 not at all not at all
## 51 several days several days
## 52 not at all not at all
## 53 not at all not at all
## 54 not at all not at all
## 55 not at all not at all
## 56 several days not at all
## 57 not at all not at all
## 58 not at all not at all
## 59 not at all not at all
## 60 several days not at all
## 61 not at all not at all
## 62 not at all not at all
## 63 not at all not at all
## 64 not at all not at all
## 65 several days several days
## 66 not at all not at all
## 67 not at all not at all
## 68 not at all not at all
## 69 not at all not at all
## 70 not at all not at all
## 71 not at all not at all
## 72 several days several days
## 73 more than half the days not at all
## 74 not at all not at all
## 75 several days not at all
## 76 not at all not at all
## 77 not at all not at all
## 78 not at all several days
## 79 several days not at all
## 80 more than half the days several days
## 81 not at all not at all
## 82 not at all not at all
## 83 not at all not at all
## 84 not at all not at all
## 85 not at all not at all
## 86 not at all not at all
## 87 not at all not at all
## 88 not at all not at all
## 89 not at all not at all
## 90 not at all not at all
## 91 not at all not at all
## 92 several days not at all
## 93 not at all not at all
## 94 not at all not at all
## 95 not at all not at all
## 96 not at all not at all
## 97 not at all not at all
## 98 several days not at all
## 99 not at all not at all
## 100 not at all not at all
## 101 not at all not at all
## 102 several days not at all
## 103 not at all not at all
## 104 not at all not at all
## 105 not at all not at all
## 106 not at all not at all
## 107 more than half the days not at all
## 108 several days not at all
## 109 not at all not at all
## 110 not at all not at all
## 111 several days not at all
## 112 not at all not at all
## 113 not at all not at all
## 114 not at all not at all
## 115 not at all not at all
## 116 not at all not at all
## 117 not at all not at all
## 118 several days not at all
## 119 several days not at all
## 120 not at all not at all
## 121 not at all not at all
## 122 not at all not at all
## 123 not at all not at all
## 124 not at all not at all
## 125 not at all not at all
## 126 more than half the days not at all
## 127 not at all not at all
## 128 several days several days
## 129 several days several days
## 130 not at all not at all
## 131 not at all not at all
## 132 not at all not at all
## 133 not at all not at all
## 134 not at all not at all
## 135 not at all not at all
## 136 more than half the days more than half the days
## 137 not at all not at all
## 138 several days not at all
## 139 not at all not at all
## 140 not at all not at all
## 141 more than half the days not at all
## 142 not at all not at all
## 143 not at all not at all
## 144 not at all not at all
## 145 not at all not at all
## 146 not at all not at all
## 147 not at all not at all
## 148 not at all not at all
## 149 not at all not at all
## 150 not at all not at all
## 151 not at all not at all
## 152 not at all not at all
## 153 not at all not at all
## 154 not at all not at all
## 155 not at all not at all
## 156 not at all not at all
## 157 not at all not at all
## 158 not at all not at all
## 159 not at all not at all
## 160 not at all not at all
## 161 not at all not at all
## 162 not at all not at all
## 163 not at all not at all
## 164 not at all not at all
## 165 not at all not at all
## 166 not at all not at all
## 167 not at all not at all
## 168 not at all more than half the days
## 169 several days not at all
## 170 more than half the days several days
## 171 not at all not at all
## 172 not at all not at all
## 173 not at all several days
## 174 several days more than half the days
## 175 not at all not at all
## 176 not at all several days
## 177 not at all not at all
## 178 not at all not at all
## 179 not at all not at all
## 180 not at all not at all
## 181 not at all not at all
## 182 not at all not at all
## 183 not at all not at all
## 184 not at all not at all
## 185 not at all not at all
## 186 not at all not at all
## 187 not at all not at all
## 188 not at all not at all
## 189 not at all not at all
## 190 not at all not at all
## 191 not at all not at all
## 192 not at all not at all
## 193 not at all not at all
## 194 not at all not at all
## 195 not at all not at all
## 196 not at all not at all
## 197 several days not at all
## 198 not at all not at all
## 199 not at all not at all
## 200 not at all not at all
## 201 not at all not at all
## 202 several days not at all
## 203 not at all not at all
## 204 not at all not at all
## 205 nearly every day nearly every day
## 206 not at all not at all
## 207 nearly every day nearly every day
## 208 not at all not at all
## 209 not at all not at all
## 210 not at all not at all
## 211 more than half the days more than half the days
## 212 several days several days
## 213 not at all not at all
## 214 not at all not at all
## 215 not at all several days
## 216 not at all not at all
## 217 not at all not at all
## 218 not at all not at all
## 219 not at all not at all
## 220 not at all not at all
## 221 not at all not at all
## 222 not at all not at all
## 223 not at all not at all
## 224 not at all not at all
## 225 not at all not at all
## 226 not at all not at all
## 227 not at all not at all
## 228 not at all not at all
## 229 not at all several days
## 230 not at all not at all
## 231 not at all not at all
## 232 not at all not at all
## 233 not at all not at all
## 234 more than half the days not at all
## 235 not at all not at all
## 236 not at all not at all
## 237 not at all not at all
## 238 not at all not at all
## 239 not at all not at all
## 240 not at all not at all
## 241 not at all not at all
## 242 not at all not at all
## 243 not at all not at all
## 244 not at all not at all
## 245 not at all several days
## 246 not at all not at all
## 247 not at all not at all
## 248 not at all more than half the days
## 249 more than half the days not at all
## 250 several days not at all
## 251 not at all not at all
## 252 several days not at all
## 253 not at all not at all
## 254 not at all not at all
## 255 not at all not at all
## 256 not at all not at all
## 257 several days not at all
## 258 not at all not at all
## 259 not at all not at all
## 260 not at all not at all
## 261 not at all not at all
## 262 not at all not at all
## 263 not at all not at all
## 264 not at all not at all
## 265 not at all not at all
## 266 not at all not at all
## 267 not at all not at all
## 268 not at all not at all
## 269 not at all not at all
## 270 not at all not at all
## 271 not at all not at all
## 272 not at all several days
## 273 not at all not at all
## 274 not at all not at all
## 275 not at all several days
## 276 not at all not at all
## 277 not at all several days
## 278 not at all not at all
## 279 not at all not at all
## 280 not at all not at all
## 281 not at all not at all
## 282 not at all not at all
## 283 not at all not at all
## 284 not at all not at all
## 285 not at all not at all
## 286 not at all not at all
## 287 not at all not at all
## 288 not at all not at all
## 289 not at all not at all
## 290 not at all not at all
## 291 not at all not at all
## 292 not at all not at all
## 293 not at all not at all
## 294 not at all not at all
## 295 not at all several days
## 296 not at all not at all
## 297 several days not at all
## 298 not at all not at all
## 299 not at all not at all
## 300 not at all not at all
## 301 not at all several days
## 302 not at all not at all
## 303 not at all not at all
## 304 more than half the days several days
## 305 not at all not at all
## 306 not at all several days
## 307 not at all not at all
## 308 not at all not at all
## 309 several days not at all
## 310 not at all not at all
## 311 not at all not at all
## 312 not at all not at all
## 313 not at all not at all
## 314 several days not at all
## 315 not at all not at all
## 316 not at all not at all
## 317 not at all not at all
## 318 not at all not at all
## 319 several days not at all
## 320 not at all not at all
## 321 not at all not at all
## 322 not at all several days
## 323 not at all not at all
## 324 not at all not at all
## 325 not at all not at all
## 326 not at all not at all
## 327 several days not at all
## 328 not at all not at all
## 329 several days not at all
## 330 not at all not at all
## 331 not at all not at all
## 332 not at all not at all
## 333 not at all not at all
## 334 not at all several days
## 335 not at all not at all
## 336 not at all not at all
## 337 not at all not at all
## 338 not at all not at all
## 339 not at all several days
## 340 not at all not at all
## 341 not at all more than half the days
## 342 not at all not at all
## 343 not at all not at all
## 344 not at all not at all
## 345 not at all not at all
## 346 several days not at all
## 347 not at all not at all
## 348 not at all not at all
## 349 not at all not at all
## 350 not at all not at all
## 351 several days nearly every day
## 352 not at all not at all
## 353 not at all not at all
## 354 not at all not at all
## 355 not at all several days
## 356 several days not at all
## 357 several days not at all
## 358 not at all not at all
## 359 several days not at all
## 360 not at all not at all
## 361 not at all not at all
## 362 not at all not at all
## 363 not at all not at all
## 364 not at all several days
## 365 not at all not at all
## 366 not at all not at all
## 367 not at all not at all
## 368 not at all not at all
## 369 several days not at all
## 370 not at all not at all
## 371 not at all more than half the days
## 372 not at all not at all
## PHQ99.r1
## 1 several days
## 2 not at all
## 3 not at all
## 4 not at all
## 5 not at all
## 6 not at all
## 7 not at all
## 8 not at all
## 9 not at all
## 10 not at all
## 11 not at all
## 12 not at all
## 13 not at all
## 14 not at all
## 15 not at all
## 16 not at all
## 17 several days
## 18 not at all
## 19 not at all
## 20 not at all
## 21 not at all
## 22 not at all
## 23 not at all
## 24 not at all
## 25 not at all
## 26 not at all
## 27 not at all
## 28 not at all
## 29 not at all
## 30 not at all
## 31 not at all
## 32 not at all
## 33 not at all
## 34 not at all
## 35 not at all
## 36 not at all
## 37 not at all
## 38 not at all
## 39 not at all
## 40 not at all
## 41 not at all
## 42 not at all
## 43 not at all
## 44 not at all
## 45 not at all
## 46 not at all
## 47 several days
## 48 not at all
## 49 not at all
## 50 not at all
## 51 several days
## 52 not at all
## 53 not at all
## 54 not at all
## 55 not at all
## 56 not at all
## 57 not at all
## 58 not at all
## 59 not at all
## 60 not at all
## 61 not at all
## 62 not at all
## 63 not at all
## 64 not at all
## 65 several days
## 66 not at all
## 67 not at all
## 68 not at all
## 69 not at all
## 70 not at all
## 71 not at all
## 72 several days
## 73 not at all
## 74 not at all
## 75 not at all
## 76 not at all
## 77 not at all
## 78 not at all
## 79 not at all
## 80 not at all
## 81 not at all
## 82 not at all
## 83 not at all
## 84 not at all
## 85 not at all
## 86 not at all
## 87 not at all
## 88 not at all
## 89 not at all
## 90 not at all
## 91 not at all
## 92 not at all
## 93 not at all
## 94 not at all
## 95 not at all
## 96 not at all
## 97 not at all
## 98 several days
## 99 not at all
## 100 not at all
## 101 not at all
## 102 more than half the days
## 103 not at all
## 104 not at all
## 105 not at all
## 106 not at all
## 107 more than half the days
## 108 not at all
## 109 not at all
## 110 not at all
## 111 not at all
## 112 several days
## 113 not at all
## 114 several days
## 115 not at all
## 116 not at all
## 117 not at all
## 118 not at all
## 119 not at all
## 120 not at all
## 121 not at all
## 122 not at all
## 123 not at all
## 124 not at all
## 125 not at all
## 126 not at all
## 127 not at all
## 128 not at all
## 129 not at all
## 130 not at all
## 131 not at all
## 132 not at all
## 133 not at all
## 134 not at all
## 135 not at all
## 136 not at all
## 137 not at all
## 138 not at all
## 139 not at all
## 140 not at all
## 141 nearly every day
## 142 not at all
## 143 not at all
## 144 not at all
## 145 not at all
## 146 not at all
## 147 not at all
## 148 not at all
## 149 not at all
## 150 not at all
## 151 not at all
## 152 not at all
## 153 not at all
## 154 not at all
## 155 not at all
## 156 not at all
## 157 not at all
## 158 not at all
## 159 not at all
## 160 not at all
## 161 not at all
## 162 not at all
## 163 not at all
## 164 not at all
## 165 not at all
## 166 not at all
## 167 not at all
## 168 not at all
## 169 several days
## 170 <NA>
## 171 not at all
## 172 not at all
## 173 not at all
## 174 not at all
## 175 not at all
## 176 not at all
## 177 not at all
## 178 not at all
## 179 not at all
## 180 not at all
## 181 not at all
## 182 not at all
## 183 not at all
## 184 not at all
## 185 not at all
## 186 not at all
## 187 not at all
## 188 not at all
## 189 more than half the days
## 190 not at all
## 191 several days
## 192 not at all
## 193 not at all
## 194 not at all
## 195 not at all
## 196 not at all
## 197 not at all
## 198 not at all
## 199 several days
## 200 not at all
## 201 not at all
## 202 not at all
## 203 not at all
## 204 not at all
## 205 nearly every day
## 206 not at all
## 207 not at all
## 208 not at all
## 209 not at all
## 210 not at all
## 211 several days
## 212 not at all
## 213 not at all
## 214 not at all
## 215 more than half the days
## 216 not at all
## 217 not at all
## 218 several days
## 219 not at all
## 220 nearly every day
## 221 not at all
## 222 not at all
## 223 not at all
## 224 not at all
## 225 not at all
## 226 not at all
## 227 not at all
## 228 not at all
## 229 several days
## 230 not at all
## 231 not at all
## 232 not at all
## 233 not at all
## 234 not at all
## 235 not at all
## 236 not at all
## 237 not at all
## 238 not at all
## 239 not at all
## 240 not at all
## 241 not at all
## 242 not at all
## 243 not at all
## 244 not at all
## 245 not at all
## 246 not at all
## 247 not at all
## 248 several days
## 249 not at all
## 250 not at all
## 251 not at all
## 252 not at all
## 253 not at all
## 254 not at all
## 255 not at all
## 256 not at all
## 257 not at all
## 258 not at all
## 259 not at all
## 260 more than half the days
## 261 not at all
## 262 not at all
## 263 not at all
## 264 not at all
## 265 not at all
## 266 not at all
## 267 not at all
## 268 not at all
## 269 not at all
## 270 not at all
## 271 not at all
## 272 several days
## 273 not at all
## 274 not at all
## 275 not at all
## 276 not at all
## 277 several days
## 278 not at all
## 279 not at all
## 280 not at all
## 281 not at all
## 282 not at all
## 283 not at all
## 284 not at all
## 285 not at all
## 286 not at all
## 287 not at all
## 288 not at all
## 289 not at all
## 290 not at all
## 291 not at all
## 292 not at all
## 293 not at all
## 294 not at all
## 295 not at all
## 296 not at all
## 297 not at all
## 298 not at all
## 299 several days
## 300 not at all
## 301 not at all
## 302 not at all
## 303 not at all
## 304 several days
## 305 not at all
## 306 not at all
## 307 not at all
## 308 not at all
## 309 nearly every day
## 310 not at all
## 311 several days
## 312 not at all
## 313 not at all
## 314 not at all
## 315 not at all
## 316 not at all
## 317 not at all
## 318 not at all
## 319 not at all
## 320 not at all
## 321 not at all
## 322 more than half the days
## 323 not at all
## 324 not at all
## 325 not at all
## 326 not at all
## 327 not at all
## 328 not at all
## 329 not at all
## 330 several days
## 331 not at all
## 332 not at all
## 333 not at all
## 334 not at all
## 335 not at all
## 336 not at all
## 337 not at all
## 338 several days
## 339 more than half the days
## 340 not at all
## 341 not at all
## 342 not at all
## 343 not at all
## 344 not at all
## 345 not at all
## 346 not at all
## 347 not at all
## 348 not at all
## 349 not at all
## 350 not at all
## 351 not at all
## 352 not at all
## 353 not at all
## 354 not at all
## 355 not at all
## 356 not at all
## 357 not at all
## 358 not at all
## 359 not at all
## 360 not at all
## 361 not at all
## 362 not at all
## 363 not at all
## 364 not at all
## 365 not at all
## 366 not at all
## 367 not at all
## 368 not at all
## 369 several days
## 370 not at all
## 371 not at all
## 372 not at all
genderGive it levels “male” and “female”
gender datR1 %>%
mutate(gender = factor(p.female.r1,
levels=c(0, 1),
labels = c("male",
"female"))) %>%
select("gender") %>%
table()## .
## male female
## 46 326
datR1 %>%
select(contains("PHQ9")) %>%
mutate_at(vars(contains("PHQ9")),
function(x) factor(x,
levels=c(0, 1, 2, 3),
labels = c("not at all",
"several days",
"more than half the days",
"nearly every day"))) %>%
likert() # %>% plot()## Item not at all several days more than half the days
## 1 PHQ91.r1 71.23656 19.623656 7.795699
## 2 PHQ92.r1 59.40860 27.150538 10.752688
## 3 PHQ93.r1 43.01075 37.365591 15.591398
## 4 PHQ94.r1 68.81720 20.698925 8.333333
## 5 PHQ95.r1 57.52688 26.612903 12.903226
## 6 PHQ96.r1 75.80645 15.860215 7.526882
## 7 PHQ97.r1 83.87097 12.634409 2.956989
## 8 PHQ98.r1 88.70968 8.602151 1.881720
## 9 PHQ99.r1 90.56604 6.469003 1.886792
## nearly every day
## 1 1.3440860
## 2 2.6881720
## 3 4.0322581
## 4 2.1505376
## 5 2.9569892
## 6 0.8064516
## 7 0.5376344
## 8 0.8064516
## 9 1.0781671
disclosedGive it levels “disclosed” and “non-disclosed”. First we need to convert all NA to 0. (hint: mutate and case_when)
disclosed datR1 %>%
mutate(doesKnow16d.r1 = case_when(is.na(doesKnow16d.r1) ~ 0,
doesKnow16d.r1==1 ~ 1,
doesKnow16d.r1==0 ~ 0)) %>%
mutate(disclosed = factor(doesKnow16d.r1,
levels=c(0, 1),
labels = c("non-disclosed",
"disclosed"))) %>%
select("disclosed") %>%
table()## .
## non-disclosed disclosed
## 123 249
grouped1 <-
datR1 %>%
mutate(doesKnow16d.r1 = case_when(is.na(doesKnow16d.r1) ~ 0,
doesKnow16d.r1==1 ~ 1,
doesKnow16d.r1==0 ~ 0)) %>%
mutate(disclosed = factor(doesKnow16d.r1,
levels=c(0, 1),
labels = c("non-disclosed",
"disclosed"))) %>%
mutate_at(vars(contains("PHQ9")),
function(x) factor(x,
levels=c(0, 1, 2, 3),
labels = c("not at all",
"several days",
"more than half the days",
"nearly every day")))
grouped2 <- grouped1
grouped1 %>%
select(contains("PHQ9")) %>%
likert(grouping=grouped1$disclosed) #%>% plot()## Group Item not at all several days more than half the days
## 1 non-disclosed PHQ91.r1 69.10569 21.951220 7.317073
## 2 non-disclosed PHQ92.r1 56.09756 32.520325 8.943089
## 3 non-disclosed PHQ93.r1 39.02439 39.024390 18.699187
## 4 non-disclosed PHQ94.r1 68.29268 19.512195 11.382114
## 5 non-disclosed PHQ95.r1 52.84553 28.455285 17.073171
## 6 non-disclosed PHQ96.r1 66.66667 22.764228 9.756098
## 7 non-disclosed PHQ97.r1 85.36585 10.569106 2.439024
## 8 non-disclosed PHQ98.r1 86.17886 9.756098 2.439024
## 9 non-disclosed PHQ99.r1 89.43089 8.130081 1.626016
## 10 disclosed PHQ91.r1 72.28916 18.473896 8.032129
## 11 disclosed PHQ92.r1 61.04418 24.497992 11.646586
## 12 disclosed PHQ93.r1 44.97992 36.546185 14.056225
## 13 disclosed PHQ94.r1 69.07631 21.285141 6.827309
## 14 disclosed PHQ95.r1 59.83936 25.702811 10.843373
## 15 disclosed PHQ96.r1 80.32129 12.449799 6.425703
## 16 disclosed PHQ97.r1 83.13253 13.654618 3.212851
## 17 disclosed PHQ98.r1 89.95984 8.032129 1.606426
## 18 disclosed PHQ99.r1 91.12903 5.645161 2.016129
## nearly every day
## 1 1.6260163
## 2 2.4390244
## 3 3.2520325
## 4 0.8130081
## 5 1.6260163
## 6 0.8130081
## 7 1.6260163
## 8 1.6260163
## 9 0.8130081
## 10 1.2048193
## 11 2.8112450
## 12 4.4176707
## 13 2.8112450
## 14 3.6144578
## 15 0.8032129
## 16 0.0000000
## 17 0.4016064
## 18 1.2096774
now()## [1] "2017-11-09 01:18:16 EST"
now(tz="Africa/Harare")## [1] "2017-11-09 08:18:16 CAT"
today()## [1] "2017-11-09"
Run OlsonNames() for timezones
ymd("2017-01-31")## [1] "2017-01-31"
mdy("January 31st, 2017")## [1] "2017-01-31"
dmy("31-Jan-2017")## [1] "2017-01-31"
ymd_hms("2017-01-31 20:11:59")## [1] "2017-01-31 20:11:59 UTC"
mdy_hm("01/31/2017 08:01")## [1] "2017-01-31 08:01:00 UTC"
year(now())## [1] 2017
month(now())## [1] 11
month(now(), label = TRUE)## [1] Nov
## 12 Levels: Jan < Feb < Mar < Apr < May < Jun < Jul < Aug < Sep < ... < Dec
mday(now())## [1] 9
wday(now())## [1] 5
wday(now(), label = TRUE, abbr = FALSE)## [1] Thursday
## 7 Levels: Sunday < Monday < Tuesday < Wednesday < Thursday < ... < Saturday
yday(now())## [1] 313
wday(now())## [1] 5
start <- ymd("2000-01-01")
inTheYear2000 <- today()-start
inTheYear2000## Time difference of 6522 days
start## [1] "2000-01-01"
start + days(4)## [1] "2000-01-05"
start + weeks(9)## [1] "2000-03-04"
Create a variable that represents the number of days between the start of the survey, June 27, 2016, and the date of disclosure (fake data).
launch <- ymd("2016-06-27")
datR1 %>%
mutate(days = launch - mdy(p.disclosureDate.r1))## p.age.r1 p.female.r1 doesKnow16d.r1 PHQ91.r1 PHQ92.r1 PHQ93.r1
## 1 77 1 1 0 0 1
## 2 36 0 1 1 1 3
## 3 39 1 1 0 1 1
## 4 34 1 NA 0 0 0
## 5 39 1 1 0 1 0
## 6 45 1 1 0 1 1
## 7 49 1 1 0 0 0
## 8 33 1 1 0 0 1
## 9 34 1 NA 2 0 3
## 10 66 1 NA 0 0 0
## 11 57 1 1 0 0 1
## 12 60 1 1 0 0 0
## 13 34 1 1 0 0 0
## 14 34 1 NA 0 0 0
## 15 36 1 NA 0 0 0
## 16 43 1 1 1 2 1
## 17 41 1 NA 1 1 1
## 18 41 1 1 0 0 0
## 19 40 1 1 0 0 0
## 20 44 1 1 0 0 0
## 21 37 1 1 1 0 0
## 22 49 0 1 0 1 1
## 23 47 1 NA 0 0 1
## 24 51 1 1 1 2 2
## 25 43 1 1 0 0 0
## 26 40 0 1 0 0 0
## 27 45 1 1 0 0 0
## 28 32 1 1 0 0 0
## 29 43 1 NA 1 1 1
## 30 58 1 1 0 1 0
## 31 44 0 1 0 2 2
## 32 38 1 NA 1 1 1
## 33 55 1 1 0 0 0
## 34 40 1 1 0 0 0
## 35 53 1 1 0 0 1
## 36 41 1 1 1 2 0
## 37 45 0 NA 1 0 2
## 38 46 1 1 0 0 0
## 39 52 1 NA 0 3 2
## 40 36 1 1 0 1 0
## 41 69 1 NA 0 0 0
## 42 42 1 NA 0 0 1
## 43 45 1 NA 0 0 0
## 44 38 1 1 0 0 3
## 45 41 0 NA 1 1 0
## 46 44 1 NA 0 0 0
## 47 51 1 1 1 1 2
## 48 65 1 0 0 1 3
## 49 63 1 NA 0 0 0
## 50 43 0 1 0 0 0
## 51 83 1 1 1 1 2
## 52 18 0 NA 0 0 0
## 53 39 1 1 0 1 0
## 54 34 1 1 2 0 0
## 55 60 1 1 0 0 0
## 56 41 1 1 0 0 1
## 57 40 1 1 0 1 1
## 58 33 1 NA 0 0 1
## 59 37 1 1 1 0 0
## 60 54 1 NA 0 1 1
## 61 47 0 1 0 0 0
## 62 59 0 NA 0 0 0
## 63 52 1 NA 0 0 1
## 64 44 0 1 0 0 0
## 65 49 1 1 1 2 3
## 66 50 1 1 0 0 0
## 67 58 1 NA 1 1 1
## 68 32 1 1 2 0 1
## 69 43 1 1 1 1 1
## 70 47 1 1 0 0 0
## 71 27 1 NA 1 1 0
## 72 72 1 NA 0 1 2
## 73 67 1 1 2 2 2
## 74 64 1 1 0 0 1
## 75 31 1 1 1 1 1
## 76 57 0 1 0 0 1
## 77 33 1 1 0 0 1
## 78 42 1 1 0 2 1
## 79 59 1 1 0 1 1
## 80 34 1 1 2 0 2
## 81 60 1 NA 0 1 2
## 82 37 1 1 0 1 0
## 83 52 1 NA 2 2 2
## 84 44 1 1 0 0 1
## 85 33 1 1 0 0 0
## 86 44 1 1 0 0 0
## 87 42 1 1 0 0 0
## 88 45 1 1 0 0 0
## 89 47 1 1 0 2 2
## 90 44 1 1 0 0 0
## 91 43 1 1 1 1 1
## 92 48 1 NA 1 1 1
## 93 18 1 NA 0 0 1
## 94 33 1 1 0 0 0
## 95 34 1 1 0 0 0
## 96 52 1 1 0 1 1
## 97 63 1 NA 1 0 1
## 98 62 1 1 0 1 1
## 99 67 1 NA 0 2 2
## 100 54 0 1 0 0 0
## 101 46 1 1 0 1 0
## 102 75 1 1 0 1 1
## 103 64 1 1 0 0 0
## 104 47 1 1 0 0 0
## 105 56 1 NA 0 0 0
## 106 37 1 NA 0 0 0
## 107 19 1 1 0 2 2
## 108 29 1 1 2 1 0
## 109 40 0 NA 0 0 0
## 110 63 1 1 0 0 1
## 111 44 0 1 0 2 2
## 112 36 1 1 2 0 0
## 113 70 1 1 0 1 1
## 114 69 1 NA 0 1 1
## 115 39 1 1 0 1 1
## 116 37 1 NA 2 1 1
## 117 60 1 1 0 0 1
## 118 37 1 1 1 1 1
## 119 60 1 1 0 0 1
## 120 32 1 1 0 1 1
## 121 79 1 1 0 0 2
## 122 35 1 1 0 0 1
## 123 60 1 1 0 1 1
## 124 61 1 1 0 0 0
## 125 48 1 NA 0 0 1
## 126 42 1 1 1 1 0
## 127 70 1 NA 0 0 0
## 128 46 1 NA 1 1 2
## 129 66 0 1 3 3 3
## 130 45 0 NA 0 0 0
## 131 38 1 1 0 0 0
## 132 44 1 1 0 0 0
## 133 66 1 1 0 0 1
## 134 22 0 1 0 0 1
## 135 46 1 1 1 0 0
## 136 55 1 1 0 1 2
## 137 36 1 NA 0 0 0
## 138 36 1 1 0 1 1
## 139 64 1 NA 0 1 0
## 140 28 1 NA 0 0 0
## 141 30 0 1 2 2 2
## 142 59 1 NA 0 0 0
## 143 36 0 1 0 0 0
## 144 25 1 1 0 0 0
## 145 45 1 1 1 1 2
## 146 45 1 1 1 0 2
## 147 47 0 1 0 0 0
## 148 36 1 1 0 0 0
## 149 40 1 NA 0 0 0
## 150 32 1 NA 0 0 0
## 151 41 1 NA 0 0 0
## 152 59 1 1 0 1 1
## 153 36 1 NA 0 1 1
## 154 58 1 1 0 0 1
## 155 55 0 1 0 0 2
## 156 49 1 1 0 0 0
## 157 38 1 NA 0 0 0
## 158 59 1 1 1 1 1
## 159 44 1 1 0 1 0
## 160 39 1 1 0 0 0
## 161 35 1 1 0 0 0
## 162 66 1 NA 3 1 1
## 163 45 0 NA 2 1 1
## 164 75 1 NA 0 0 1
## 165 48 1 1 0 0 0
## 166 46 1 NA 0 0 1
## 167 48 0 1 0 0 0
## 168 32 1 1 2 0 2
## 169 35 1 1 0 1 1
## 170 59 1 1 2 3 3
## 171 62 1 1 0 0 0
## 172 67 1 1 1 2 1
## 173 57 1 NA 1 1 0
## 174 56 1 NA 1 0 2
## 175 59 1 NA 0 0 0
## 176 50 1 1 1 0 1
## 177 66 0 1 0 0 1
## 178 35 1 1 0 0 1
## 179 39 0 1 0 0 0
## 180 42 1 1 1 1 1
## 181 39 1 1 0 0 0
## 182 38 1 1 0 0 0
## 183 46 1 1 2 2 2
## 184 34 1 NA 0 0 0
## 185 57 1 NA 0 1 0
## 186 44 1 1 1 1 0
## 187 53 1 1 0 0 0
## 188 47 1 1 0 0 1
## 189 84 1 NA 0 2 2
## 190 39 1 1 1 0 0
## 191 43 1 NA 0 1 1
## 192 64 1 1 0 1 1
## 193 53 1 1 0 3 2
## 194 64 1 1 0 0 0
## 195 49 1 NA 1 2 1
## 196 35 1 1 0 0 0
## 197 43 1 1 2 0 1
## 198 46 1 1 0 0 1
## 199 56 1 1 1 1 2
## 200 56 1 NA 1 1 2
## 201 36 1 1 0 0 0
## 202 34 1 1 2 0 0
## 203 52 1 NA 0 0 1
## 204 65 1 NA 1 1 1
## 205 42 1 NA 3 3 3
## 206 38 1 1 0 1 1
## 207 64 1 NA 0 1 2
## 208 39 1 1 0 0 0
## 209 64 1 NA 0 0 1
## 210 62 1 1 0 0 0
## 211 56 1 NA 2 2 2
## 212 64 1 NA 1 2 2
## 213 62 1 1 1 1 2
## 214 35 0 1 0 0 0
## 215 82 1 1 1 2 2
## 216 37 1 NA 0 0 0
## 217 55 0 NA 0 1 1
## 218 63 1 NA 0 1 0
## 219 36 1 NA 0 0 1
## 220 42 1 1 0 2 2
## 221 57 1 1 1 0 3
## 222 36 1 1 0 0 0
## 223 27 0 1 0 0 0
## 224 51 1 1 0 0 2
## 225 75 1 1 0 1 0
## 226 48 0 1 0 0 0
## 227 52 1 1 0 0 0
## 228 42 1 1 0 0 2
## 229 60 1 1 1 2 1
## 230 58 1 1 1 1 1
## 231 45 1 NA 0 0 1
## 232 86 1 NA 0 1 1
## 233 36 1 1 2 0 0
## 234 43 1 NA 0 1 0
## 235 47 1 1 0 0 0
## 236 72 0 NA 0 0 0
## 237 47 0 1 0 0 1
## 238 49 1 1 1 1 1
## 239 54 1 1 0 0 0
## 240 50 1 1 0 1 1
## 241 60 1 1 1 1 1
## 242 34 1 1 0 2 2
## 243 46 0 NA 1 0 1
## 244 50 1 1 0 0 0
## 245 56 1 1 0 0 0
## 246 67 1 1 1 0 0
## 247 27 1 NA 0 0 0
## 248 39 1 1 2 2 2
## 249 62 1 NA 0 1 0
## 250 65 1 1 1 0 1
## 251 34 1 1 1 1 1
## 252 45 1 1 0 0 1
## 253 38 1 1 0 0 1
## 254 40 1 1 0 0 0
## 255 48 1 NA 0 0 0
## 256 46 1 1 0 0 0
## 257 44 1 1 1 1 1
## 258 52 1 1 1 1 1
## 259 37 1 1 0 0 0
## 260 73 1 NA 0 3 1
## 261 51 1 NA 0 0 0
## 262 49 1 1 0 0 0
## 263 54 0 1 0 0 0
## 264 42 1 1 0 1 1
## 265 55 1 1 0 1 0
## 266 29 1 1 0 0 0
## 267 54 1 1 1 2 3
## 268 41 1 1 1 0 0
## 269 40 1 1 0 0 0
## 270 78 1 NA 0 0 1
## 271 66 1 NA 0 0 1
## 272 42 1 NA 1 1 1
## 273 40 1 1 0 0 3
## 274 30 1 NA 0 0 0
## 275 35 0 1 0 0 1
## 276 38 1 NA 0 1 1
## 277 73 1 NA 1 1 1
## 278 29 1 1 2 0 1
## 279 35 1 1 0 1 1
## 280 42 1 1 0 0 0
## 281 46 0 1 0 0 0
## 282 45 1 1 0 0 0
## 283 32 1 NA 0 0 2
## 284 36 1 NA 0 0 0
## 285 61 1 NA 0 0 0
## 286 40 1 NA 1 1 1
## 287 44 1 1 0 0 2
## 288 69 1 1 0 1 1
## 289 55 1 1 0 0 2
## 290 38 1 1 0 0 0
## 291 20 1 NA 0 0 1
## 292 45 1 1 0 0 1
## 293 36 1 1 0 2 0
## 294 33 1 NA 1 0 1
## 295 67 1 NA 0 1 1
## 296 62 1 1 0 0 1
## 297 52 1 1 1 1 1
## 298 43 1 NA 0 0 1
## 299 37 1 NA 0 1 2
## 300 35 0 1 0 0 0
## 301 23 0 1 0 1 1
## 302 65 1 1 0 0 1
## 303 44 1 NA 2 0 2
## 304 79 1 1 1 2 2
## 305 34 1 1 0 0 1
## 306 65 1 1 0 1 1
## 307 37 1 1 0 0 0
## 308 73 1 NA 0 0 0
## 309 59 1 1 1 1 2
## 310 57 1 1 2 0 1
## 311 67 1 NA 2 2 3
## 312 48 1 1 0 0 0
## 313 38 1 1 0 2 1
## 314 29 1 NA 0 1 1
## 315 61 1 1 0 0 0
## 316 40 0 1 0 0 1
## 317 50 1 1 0 0 1
## 318 63 1 1 0 0 1
## 319 48 1 NA 1 2 2
## 320 59 1 1 0 1 0
## 321 35 0 NA 0 1 2
## 322 47 1 1 2 3 3
## 323 65 1 NA 0 1 1
## 324 42 1 1 0 0 0
## 325 43 1 1 0 0 0
## 326 53 1 1 0 2 2
## 327 51 0 1 2 1 1
## 328 61 1 NA 1 0 0
## 329 64 1 1 1 1 1
## 330 38 1 1 2 2 2
## 331 55 1 1 0 0 0
## 332 35 1 NA 0 0 0
## 333 78 1 1 0 0 1
## 334 56 1 1 1 0 2
## 335 40 1 1 1 1 0
## 336 45 1 1 0 2 2
## 337 49 0 1 0 0 0
## 338 66 1 1 0 1 1
## 339 55 1 1 1 2 0
## 340 40 1 1 0 0 1
## 341 33 1 1 2 2 2
## 342 53 1 1 0 0 1
## 343 41 1 1 0 0 1
## 344 45 1 NA 0 0 1
## 345 74 1 1 0 0 1
## 346 48 1 1 3 3 3
## 347 33 1 1 0 0 0
## 348 40 1 NA 1 0 2
## 349 34 1 NA 1 1 0
## 350 71 1 NA 0 0 1
## 351 40 1 1 3 3 3
## 352 46 1 NA 0 0 0
## 353 54 1 1 0 0 0
## 354 48 0 1 0 0 0
## 355 45 1 NA 0 0 0
## 356 65 1 NA 1 1 1
## 357 35 1 NA 1 0 1
## 358 45 1 NA 2 2 2
## 359 70 0 1 1 0 1
## 360 34 1 1 0 0 1
## 361 57 1 1 0 2 1
## 362 34 1 1 0 3 0
## 363 42 1 1 0 0 1
## 364 37 1 NA 2 2 2
## 365 31 1 1 0 2 1
## 366 29 1 NA 0 0 0
## 367 36 0 NA 0 0 0
## 368 32 1 1 0 0 0
## 369 30 1 1 0 0 0
## 370 44 0 NA 0 2 2
## 371 44 1 NA 0 0 2
## 372 54 1 NA 0 0 1
## PHQ94.r1 PHQ95.r1 PHQ96.r1 PHQ97.r1 PHQ98.r1 PHQ99.r1
## 1 0 1 0 0 0 1
## 2 0 0 1 1 0 0
## 3 0 1 0 0 0 0
## 4 0 1 0 0 0 0
## 5 2 2 1 0 0 0
## 6 1 0 0 1 0 0
## 7 0 0 0 0 0 0
## 8 0 1 0 0 0 0
## 9 2 1 0 0 0 0
## 10 0 0 0 0 0 0
## 11 0 0 0 0 0 0
## 12 0 0 0 0 0 0
## 13 0 0 0 0 0 0
## 14 0 1 1 0 0 0
## 15 0 0 0 0 0 0
## 16 1 1 0 0 0 0
## 17 1 1 1 1 0 1
## 18 0 1 0 1 0 0
## 19 1 1 0 0 0 0
## 20 0 0 0 1 1 0
## 21 1 1 0 0 0 0
## 22 0 1 0 0 0 0
## 23 0 1 0 0 0 0
## 24 0 0 0 0 0 0
## 25 0 1 0 0 0 0
## 26 0 0 0 0 0 0
## 27 0 0 0 0 0 0
## 28 0 0 0 0 0 0
## 29 0 1 2 0 1 0
## 30 0 2 0 0 1 0
## 31 2 2 2 1 0 0
## 32 1 0 1 1 0 0
## 33 0 0 0 0 0 0
## 34 0 0 0 0 0 0
## 35 0 0 0 0 0 0
## 36 1 1 1 1 1 0
## 37 2 0 0 0 0 0
## 38 0 0 0 0 0 0
## 39 0 0 0 0 0 0
## 40 0 1 1 1 0 0
## 41 0 0 0 0 0 0
## 42 0 0 0 0 0 0
## 43 0 0 0 0 0 0
## 44 0 0 0 0 0 0
## 45 0 1 2 0 1 0
## 46 0 0 0 0 0 0
## 47 1 1 1 0 0 1
## 48 1 1 1 1 1 0
## 49 1 2 0 0 0 0
## 50 0 1 0 0 0 0
## 51 2 0 0 1 1 1
## 52 0 0 0 0 0 0
## 53 0 0 0 0 0 0
## 54 0 2 0 0 0 0
## 55 0 0 0 0 0 0
## 56 0 0 0 1 0 0
## 57 1 0 0 0 0 0
## 58 0 0 0 0 0 0
## 59 0 0 0 0 0 0
## 60 1 1 1 1 0 0
## 61 0 0 0 0 0 0
## 62 0 0 1 0 0 0
## 63 0 0 0 0 0 0
## 64 0 0 0 0 0 0
## 65 2 2 1 1 1 1
## 66 0 0 0 0 0 0
## 67 1 0 1 0 0 0
## 68 1 1 0 0 0 0
## 69 1 3 1 0 0 0
## 70 0 0 0 0 0 0
## 71 1 1 1 0 0 0
## 72 2 2 1 1 1 1
## 73 2 2 0 2 0 0
## 74 0 0 0 0 0 0
## 75 0 0 1 1 0 0
## 76 0 1 0 0 0 0
## 77 0 0 0 0 0 0
## 78 0 0 1 0 1 0
## 79 0 0 0 1 0 0
## 80 2 2 0 2 1 0
## 81 0 0 1 0 0 0
## 82 0 1 1 0 0 0
## 83 2 1 1 0 0 0
## 84 1 0 0 0 0 0
## 85 1 0 0 0 0 0
## 86 0 0 0 0 0 0
## 87 1 1 0 0 0 0
## 88 0 0 0 0 0 0
## 89 0 1 0 0 0 0
## 90 0 0 0 0 0 0
## 91 0 1 0 0 0 0
## 92 1 1 0 1 0 0
## 93 0 0 1 0 0 0
## 94 0 0 0 0 0 0
## 95 0 0 0 0 0 0
## 96 0 0 0 0 0 0
## 97 0 1 0 0 0 0
## 98 0 1 0 1 0 1
## 99 0 1 1 0 0 0
## 100 0 0 0 0 0 0
## 101 0 0 0 0 0 0
## 102 1 1 1 1 0 2
## 103 0 0 0 0 0 0
## 104 1 0 0 0 0 0
## 105 0 0 0 0 0 0
## 106 0 0 0 0 0 0
## 107 2 2 2 2 0 2
## 108 0 0 0 1 0 0
## 109 0 0 0 0 0 0
## 110 0 0 0 0 0 0
## 111 1 1 1 1 0 0
## 112 0 0 0 0 0 1
## 113 0 1 0 0 0 0
## 114 1 1 0 0 0 1
## 115 0 0 0 0 0 0
## 116 1 1 0 0 0 0
## 117 0 1 0 0 0 0
## 118 1 2 1 1 0 0
## 119 0 1 0 1 0 0
## 120 0 1 0 0 0 0
## 121 2 0 0 0 0 0
## 122 0 0 0 0 0 0
## 123 0 1 0 0 0 0
## 124 0 0 0 0 0 0
## 125 0 0 0 0 0 0
## 126 1 1 0 2 0 0
## 127 0 0 0 0 0 0
## 128 2 3 2 1 1 0
## 129 3 2 2 1 1 0
## 130 0 0 0 0 0 0
## 131 0 0 0 0 0 0
## 132 2 0 2 0 0 0
## 133 1 0 0 0 0 0
## 134 0 0 1 0 0 0
## 135 0 0 0 0 0 0
## 136 2 2 2 2 2 0
## 137 0 0 0 0 0 0
## 138 1 1 1 1 0 0
## 139 0 1 1 0 0 0
## 140 0 2 1 0 0 0
## 141 0 3 3 2 0 3
## 142 0 1 0 0 0 0
## 143 0 0 0 0 0 0
## 144 0 1 0 0 0 0
## 145 1 1 0 0 0 0
## 146 0 0 0 0 0 0
## 147 0 0 0 0 0 0
## 148 0 0 0 0 0 0
## 149 0 0 0 0 0 0
## 150 0 0 2 0 0 0
## 151 0 1 0 0 0 0
## 152 0 0 1 0 0 0
## 153 1 1 1 0 0 0
## 154 1 0 0 0 0 0
## 155 0 1 0 0 0 0
## 156 0 2 0 0 0 0
## 157 0 1 1 0 0 0
## 158 1 0 0 0 0 0
## 159 1 0 2 0 0 0
## 160 0 0 0 0 0 0
## 161 0 3 0 0 0 0
## 162 1 1 0 0 0 0
## 163 0 2 0 0 0 0
## 164 0 0 0 0 0 0
## 165 0 0 1 0 0 0
## 166 0 2 0 0 0 0
## 167 0 0 0 0 0 0
## 168 0 1 0 0 2 0
## 169 2 1 1 1 0 1
## 170 3 2 1 2 1 NA
## 171 0 0 0 0 0 0
## 172 2 0 0 0 0 0
## 173 1 1 0 0 1 0
## 174 2 0 0 1 2 0
## 175 0 0 0 0 0 0
## 176 1 1 0 0 1 0
## 177 0 1 0 0 0 0
## 178 0 0 0 0 0 0
## 179 0 0 0 0 0 0
## 180 0 0 0 0 0 0
## 181 0 0 0 0 0 0
## 182 0 0 0 0 0 0
## 183 2 2 1 0 0 0
## 184 0 0 0 0 0 0
## 185 0 0 0 0 0 0
## 186 0 0 0 0 0 0
## 187 0 0 0 0 0 0
## 188 1 1 0 0 0 0
## 189 0 2 2 0 0 2
## 190 1 2 0 0 0 0
## 191 1 0 1 0 0 1
## 192 0 0 0 0 0 0
## 193 0 0 2 0 0 0
## 194 0 0 0 0 0 0
## 195 1 2 0 0 0 0
## 196 0 0 0 0 0 0
## 197 0 1 1 1 0 0
## 198 1 1 0 0 0 0
## 199 2 1 0 0 0 1
## 200 2 2 0 0 0 0
## 201 0 2 0 0 0 0
## 202 0 2 0 1 0 0
## 203 0 0 0 0 0 0
## 204 1 1 1 0 0 0
## 205 3 2 2 3 3 3
## 206 0 0 0 0 0 0
## 207 2 2 3 3 3 0
## 208 0 0 0 0 0 0
## 209 0 0 0 0 0 0
## 210 0 0 0 0 0 0
## 211 2 2 2 2 2 1
## 212 2 2 0 1 1 0
## 213 0 3 1 0 0 0
## 214 1 0 0 0 0 0
## 215 1 1 2 0 1 2
## 216 0 0 0 0 0 0
## 217 0 0 0 0 0 0
## 218 0 0 1 0 0 1
## 219 0 1 0 0 0 0
## 220 0 0 2 0 0 3
## 221 0 0 1 0 0 0
## 222 0 0 0 0 0 0
## 223 0 0 0 0 0 0
## 224 0 0 0 0 0 0
## 225 0 0 0 0 0 0
## 226 0 0 0 0 0 0
## 227 0 1 0 0 0 0
## 228 2 2 0 0 0 0
## 229 1 1 0 0 1 1
## 230 1 0 0 0 0 0
## 231 0 0 0 0 0 0
## 232 0 1 0 0 0 0
## 233 0 3 0 0 0 0
## 234 0 0 2 2 0 0
## 235 0 0 0 0 0 0
## 236 0 0 0 0 0 0
## 237 0 1 0 0 0 0
## 238 1 1 0 0 0 0
## 239 0 0 0 0 0 0
## 240 0 0 0 0 0 0
## 241 1 1 0 0 0 0
## 242 0 0 0 0 0 0
## 243 1 0 1 0 0 0
## 244 1 0 0 0 0 0
## 245 0 0 0 0 1 0
## 246 0 0 0 0 0 0
## 247 0 0 2 0 0 0
## 248 3 1 0 0 2 1
## 249 0 1 0 2 0 0
## 250 1 1 0 1 0 0
## 251 1 0 0 0 0 0
## 252 0 0 0 1 0 0
## 253 0 0 0 0 0 0
## 254 0 0 0 0 0 0
## 255 0 0 0 0 0 0
## 256 0 0 0 0 0 0
## 257 1 1 1 1 0 0
## 258 0 1 0 0 0 0
## 259 0 0 0 0 0 0
## 260 1 1 1 0 0 2
## 261 0 0 0 0 0 0
## 262 0 2 1 0 0 0
## 263 0 0 0 0 0 0
## 264 0 0 0 0 0 0
## 265 0 0 0 0 0 0
## 266 0 1 3 0 0 0
## 267 0 1 2 0 0 0
## 268 0 1 0 0 0 0
## 269 0 0 0 0 0 0
## 270 0 0 0 0 0 0
## 271 1 1 0 0 0 0
## 272 2 1 0 0 1 1
## 273 0 0 0 0 0 0
## 274 0 0 0 0 0 0
## 275 0 0 0 0 1 0
## 276 0 0 1 0 0 0
## 277 1 1 1 0 1 1
## 278 0 0 0 0 0 0
## 279 0 1 0 0 0 0
## 280 0 0 0 0 0 0
## 281 0 0 0 0 0 0
## 282 1 1 0 0 0 0
## 283 0 2 0 0 0 0
## 284 0 0 0 0 0 0
## 285 0 0 0 0 0 0
## 286 1 1 1 0 0 0
## 287 1 1 2 0 0 0
## 288 0 0 0 0 0 0
## 289 0 0 0 0 0 0
## 290 0 0 0 0 0 0
## 291 0 2 0 0 0 0
## 292 0 0 1 0 0 0
## 293 0 0 1 0 0 0
## 294 0 2 0 0 0 0
## 295 1 0 0 0 1 0
## 296 0 2 0 0 0 0
## 297 0 2 0 1 0 0
## 298 0 1 0 0 0 0
## 299 0 2 0 0 0 1
## 300 0 0 0 0 0 0
## 301 1 2 2 0 1 0
## 302 0 0 0 0 0 0
## 303 0 0 2 0 0 0
## 304 2 2 2 2 1 1
## 305 0 0 0 0 0 0
## 306 1 2 0 0 1 0
## 307 0 0 0 0 0 0
## 308 0 0 0 0 0 0
## 309 1 0 1 1 0 3
## 310 1 1 0 0 0 0
## 311 0 1 0 0 0 1
## 312 0 0 0 0 0 0
## 313 0 1 0 0 0 0
## 314 1 3 2 1 0 0
## 315 0 0 0 0 0 0
## 316 1 0 2 0 0 0
## 317 1 0 0 0 0 0
## 318 0 0 0 0 0 0
## 319 2 2 2 1 0 0
## 320 0 0 0 0 0 0
## 321 0 0 0 0 0 0
## 322 3 0 0 0 1 2
## 323 0 0 0 0 0 0
## 324 0 0 0 0 0 0
## 325 0 0 0 0 0 0
## 326 1 2 0 0 0 0
## 327 1 0 2 1 0 0
## 328 0 0 0 0 0 0
## 329 1 2 0 1 0 0
## 330 2 2 2 0 0 1
## 331 1 1 0 0 0 0
## 332 0 0 0 0 0 0
## 333 0 0 0 0 0 0
## 334 0 0 1 0 1 0
## 335 1 1 0 0 0 0
## 336 0 0 0 0 0 0
## 337 0 0 0 0 0 0
## 338 0 0 0 0 0 1
## 339 0 1 1 0 1 2
## 340 1 0 0 0 0 0
## 341 3 3 0 0 2 0
## 342 0 0 0 0 0 0
## 343 0 0 0 0 0 0
## 344 0 0 0 0 0 0
## 345 0 1 0 0 0 0
## 346 3 3 0 1 0 0
## 347 0 1 0 0 0 0
## 348 0 2 1 0 0 0
## 349 0 0 0 0 0 0
## 350 0 0 0 0 0 0
## 351 3 3 0 1 3 0
## 352 0 0 0 0 0 0
## 353 0 0 0 0 0 0
## 354 0 0 0 0 0 0
## 355 0 0 1 0 1 0
## 356 0 1 0 1 0 0
## 357 0 0 1 1 0 0
## 358 2 2 0 0 0 0
## 359 1 1 0 1 0 0
## 360 0 0 0 0 0 0
## 361 0 0 0 0 0 0
## 362 0 3 0 0 0 0
## 363 0 0 0 0 0 0
## 364 0 2 0 0 1 0
## 365 0 0 0 0 0 0
## 366 0 0 0 0 0 0
## 367 0 0 0 0 0 0
## 368 0 0 0 0 0 0
## 369 1 0 1 1 0 1
## 370 1 0 0 0 0 0
## 371 2 2 0 0 2 0
## 372 0 0 0 0 0 0
## p.disclosureDate.r1 days
## 1 2/24/14 854 days
## 2 12/30/14 545 days
## 3 6/23/14 735 days
## 4 <NA> NA days
## 5 12/22/13 918 days
## 6 11/6/13 964 days
## 7 11/6/15 234 days
## 8 8/3/14 694 days
## 9 <NA> NA days
## 10 <NA> NA days
## 11 3/29/14 821 days
## 12 10/10/15 261 days
## 13 7/17/13 1076 days
## 14 <NA> NA days
## 15 <NA> NA days
## 16 1/14/15 530 days
## 17 <NA> NA days
## 18 7/3/15 360 days
## 19 11/18/14 587 days
## 20 12/14/13 926 days
## 21 6/2/15 391 days
## 22 6/29/15 364 days
## 23 <NA> NA days
## 24 1/12/13 1262 days
## 25 5/3/15 421 days
## 26 9/20/13 1011 days
## 27 4/13/14 806 days
## 28 1/9/14 900 days
## 29 <NA> NA days
## 30 6/15/13 1108 days
## 31 9/25/14 641 days
## 32 <NA> NA days
## 33 8/27/15 305 days
## 34 1/26/13 1248 days
## 35 4/12/15 442 days
## 36 4/16/13 1168 days
## 37 <NA> NA days
## 38 4/15/15 439 days
## 39 <NA> NA days
## 40 8/6/14 691 days
## 41 <NA> NA days
## 42 <NA> NA days
## 43 <NA> NA days
## 44 5/10/15 414 days
## 45 <NA> NA days
## 46 <NA> NA days
## 47 9/13/13 1018 days
## 48 <NA> NA days
## 49 <NA> NA days
## 50 11/10/13 960 days
## 51 9/29/14 637 days
## 52 <NA> NA days
## 53 8/19/14 678 days
## 54 8/14/14 683 days
## 55 5/13/15 411 days
## 56 2/24/13 1219 days
## 57 6/20/14 738 days
## 58 <NA> NA days
## 59 1/29/14 880 days
## 60 <NA> NA days
## 61 10/17/13 984 days
## 62 <NA> NA days
## 63 <NA> NA days
## 64 11/1/13 969 days
## 65 10/28/13 973 days
## 66 1/21/15 523 days
## 67 <NA> NA days
## 68 9/13/14 653 days
## 69 11/5/15 235 days
## 70 10/19/13 982 days
## 71 <NA> NA days
## 72 <NA> NA days
## 73 4/27/13 1157 days
## 74 3/21/13 1194 days
## 75 10/29/13 972 days
## 76 4/4/15 450 days
## 77 1/27/13 1247 days
## 78 9/4/13 1027 days
## 79 11/3/14 602 days
## 80 8/18/13 1044 days
## 81 <NA> NA days
## 82 11/21/14 584 days
## 83 <NA> NA days
## 84 8/14/15 318 days
## 85 9/7/15 294 days
## 86 7/9/14 719 days
## 87 9/27/14 639 days
## 88 9/19/14 647 days
## 89 9/4/15 297 days
## 90 11/21/14 584 days
## 91 2/6/13 1237 days
## 92 <NA> NA days
## 93 <NA> NA days
## 94 11/29/15 211 days
## 95 9/28/15 273 days
## 96 11/15/14 590 days
## 97 <NA> NA days
## 98 8/26/13 1036 days
## 99 <NA> NA days
## 100 5/16/13 1138 days
## 101 3/25/15 460 days
## 102 4/26/13 1158 days
## 103 1/10/14 899 days
## 104 11/2/13 968 days
## 105 <NA> NA days
## 106 <NA> NA days
## 107 12/1/14 574 days
## 108 11/21/14 584 days
## 109 <NA> NA days
## 110 11/30/13 940 days
## 111 9/12/15 289 days
## 112 12/26/14 549 days
## 113 11/12/13 958 days
## 114 <NA> NA days
## 115 7/20/13 1073 days
## 116 <NA> NA days
## 117 9/10/14 656 days
## 118 10/1/15 270 days
## 119 5/24/13 1130 days
## 120 4/14/13 1170 days
## 121 6/14/15 379 days
## 122 4/20/15 434 days
## 123 2/15/14 863 days
## 124 6/7/15 386 days
## 125 <NA> NA days
## 126 9/27/15 274 days
## 127 <NA> NA days
## 128 <NA> NA days
## 129 9/14/15 287 days
## 130 <NA> NA days
## 131 6/13/14 745 days
## 132 6/23/14 735 days
## 133 1/27/13 1247 days
## 134 9/16/15 285 days
## 135 4/1/15 453 days
## 136 4/8/13 1176 days
## 137 <NA> NA days
## 138 6/2/15 391 days
## 139 <NA> NA days
## 140 <NA> NA days
## 141 8/19/13 1043 days
## 142 <NA> NA days
## 143 5/20/14 769 days
## 144 4/9/14 810 days
## 145 3/12/13 1203 days
## 146 3/26/14 824 days
## 147 11/29/13 941 days
## 148 7/23/13 1070 days
## 149 <NA> NA days
## 150 <NA> NA days
## 151 <NA> NA days
## 152 3/12/15 473 days
## 153 <NA> NA days
## 154 5/15/15 409 days
## 155 8/25/14 672 days
## 156 8/28/14 669 days
## 157 <NA> NA days
## 158 9/7/14 659 days
## 159 9/9/15 292 days
## 160 9/4/13 1027 days
## 161 7/7/14 721 days
## 162 <NA> NA days
## 163 <NA> NA days
## 164 <NA> NA days
## 165 12/4/13 936 days
## 166 <NA> NA days
## 167 11/9/13 961 days
## 168 4/29/14 790 days
## 169 8/14/14 683 days
## 170 7/4/13 1089 days
## 171 10/3/14 633 days
## 172 4/12/13 1172 days
## 173 <NA> NA days
## 174 <NA> NA days
## 175 <NA> NA days
## 176 10/10/14 626 days
## 177 3/6/15 479 days
## 178 12/4/13 936 days
## 179 6/18/14 740 days
## 180 12/26/14 549 days
## 181 7/1/14 727 days
## 182 7/31/14 697 days
## 183 1/2/15 542 days
## 184 <NA> NA days
## 185 <NA> NA days
## 186 10/4/14 632 days
## 187 8/27/13 1035 days
## 188 10/26/14 610 days
## 189 <NA> NA days
## 190 8/15/13 1047 days
## 191 <NA> NA days
## 192 2/20/14 858 days
## 193 10/30/13 971 days
## 194 7/14/13 1079 days
## 195 <NA> NA days
## 196 8/29/14 668 days
## 197 12/4/15 206 days
## 198 7/24/15 339 days
## 199 9/8/15 293 days
## 200 <NA> NA days
## 201 9/14/14 652 days
## 202 10/24/15 247 days
## 203 <NA> NA days
## 204 <NA> NA days
## 205 <NA> NA days
## 206 9/22/14 644 days
## 207 <NA> NA days
## 208 1/8/15 536 days
## 209 <NA> NA days
## 210 4/2/14 817 days
## 211 <NA> NA days
## 212 <NA> NA days
## 213 7/13/15 350 days
## 214 10/28/14 608 days
## 215 3/4/15 481 days
## 216 <NA> NA days
## 217 <NA> NA days
## 218 <NA> NA days
## 219 <NA> NA days
## 220 3/25/14 825 days
## 221 1/19/14 890 days
## 222 8/16/13 1046 days
## 223 5/25/15 399 days
## 224 11/25/13 945 days
## 225 8/17/13 1045 days
## 226 5/17/14 772 days
## 227 11/10/13 960 days
## 228 9/28/15 273 days
## 229 8/26/14 671 days
## 230 10/30/15 241 days
## 231 <NA> NA days
## 232 <NA> NA days
## 233 10/17/14 619 days
## 234 <NA> NA days
## 235 9/6/15 295 days
## 236 <NA> NA days
## 237 6/25/13 1098 days
## 238 2/6/15 507 days
## 239 12/5/15 205 days
## 240 11/25/13 945 days
## 241 11/26/14 579 days
## 242 3/29/15 456 days
## 243 <NA> NA days
## 244 1/22/15 522 days
## 245 9/28/15 273 days
## 246 4/30/14 789 days
## 247 <NA> NA days
## 248 5/8/14 781 days
## 249 <NA> NA days
## 250 11/20/13 950 days
## 251 11/15/13 955 days
## 252 1/21/14 888 days
## 253 7/14/15 349 days
## 254 11/8/14 597 days
## 255 <NA> NA days
## 256 9/27/14 639 days
## 257 3/2/13 1213 days
## 258 6/29/15 364 days
## 259 10/18/14 618 days
## 260 <NA> NA days
## 261 <NA> NA days
## 262 12/10/14 565 days
## 263 8/22/13 1040 days
## 264 11/10/15 230 days
## 265 3/19/15 466 days
## 266 6/7/13 1116 days
## 267 1/14/14 895 days
## 268 3/11/14 839 days
## 269 9/24/13 1007 days
## 270 <NA> NA days
## 271 <NA> NA days
## 272 <NA> NA days
## 273 2/16/13 1227 days
## 274 <NA> NA days
## 275 1/12/13 1262 days
## 276 <NA> NA days
## 277 <NA> NA days
## 278 11/21/13 949 days
## 279 6/15/13 1108 days
## 280 7/30/13 1063 days
## 281 10/1/14 635 days
## 282 1/9/14 900 days
## 283 <NA> NA days
## 284 <NA> NA days
## 285 <NA> NA days
## 286 <NA> NA days
## 287 2/20/14 858 days
## 288 10/11/15 260 days
## 289 7/24/15 339 days
## 290 9/21/13 1010 days
## 291 <NA> NA days
## 292 11/13/15 227 days
## 293 10/31/13 970 days
## 294 <NA> NA days
## 295 <NA> NA days
## 296 6/23/15 370 days
## 297 11/20/15 220 days
## 298 <NA> NA days
## 299 <NA> NA days
## 300 5/6/15 418 days
## 301 7/31/15 332 days
## 302 2/10/13 1233 days
## 303 <NA> NA days
## 304 6/13/14 745 days
## 305 10/19/13 982 days
## 306 12/21/14 554 days
## 307 11/2/13 968 days
## 308 <NA> NA days
## 309 5/1/14 788 days
## 310 9/20/15 281 days
## 311 <NA> NA days
## 312 5/19/14 770 days
## 313 3/31/14 819 days
## 314 <NA> NA days
## 315 6/27/14 731 days
## 316 5/11/15 413 days
## 317 5/9/13 1145 days
## 318 4/18/15 436 days
## 319 <NA> NA days
## 320 2/26/14 852 days
## 321 <NA> NA days
## 322 11/28/14 577 days
## 323 <NA> NA days
## 324 9/29/13 1002 days
## 325 4/4/14 815 days
## 326 11/15/13 955 days
## 327 8/5/14 692 days
## 328 <NA> NA days
## 329 9/27/14 639 days
## 330 9/27/15 274 days
## 331 9/17/14 649 days
## 332 <NA> NA days
## 333 5/13/13 1141 days
## 334 3/11/13 1204 days
## 335 8/25/14 672 days
## 336 8/29/14 668 days
## 337 4/8/13 1176 days
## 338 8/26/14 671 days
## 339 2/8/14 870 days
## 340 11/28/13 942 days
## 341 6/10/13 1113 days
## 342 2/5/14 873 days
## 343 10/6/15 265 days
## 344 <NA> NA days
## 345 1/13/15 531 days
## 346 11/24/15 216 days
## 347 5/21/13 1133 days
## 348 <NA> NA days
## 349 <NA> NA days
## 350 <NA> NA days
## 351 5/23/15 401 days
## 352 <NA> NA days
## 353 8/16/15 316 days
## 354 4/9/13 1175 days
## 355 <NA> NA days
## 356 <NA> NA days
## 357 <NA> NA days
## 358 <NA> NA days
## 359 1/16/14 893 days
## 360 7/31/13 1062 days
## 361 9/6/15 295 days
## 362 9/5/14 661 days
## 363 11/17/13 953 days
## 364 <NA> NA days
## 365 5/3/14 786 days
## 366 <NA> NA days
## 367 <NA> NA days
## 368 6/21/13 1102 days
## 369 5/6/13 1148 days
## 370 <NA> NA days
## 371 <NA> NA days
## 372 <NA> NA days
launch <- ymd("2016-06-27")
datR1 %>%
mutate(days = launch - mdy(p.disclosureDate.r1)) %>%
summarise(meanDays = mean(days, na.rm=TRUE))## meanDays
## 1 727.1847 days
Wickham, Hadley, and Garrett Grolemund. 2017. R for Data Science. O’Reilly. http://r4ds.had.co.nz/.